I have two xhtml files. One as a complete page to be displayed and another that uses a template (). When I call the file directly (the complete file) all the effects contained in work perfectly, but when I call the page that uses the template the page is loaded but the effects of paging not work and gives the following exception:
“17:14:07,031 SEVERE
[javax.enterprise.resource.webcontainer.jsf.application] (http –
0.0.0.0-8090-3) JSF1007: component ID duplicated messages found in the preview. 17:14:07,031 SEVERE
[javax.enterprise.resource.webcontainer.jsf.application] (http –
0.0.0.0-8090-3) + id: j_id1 “
The complete code (fileA.xhtml):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Parâmetros Integrator</title>
</h:head>
<h:body>
<f:view>
<h:form prependId="false">
<p:dataTable id="dataTable" var="valor" value="#{parametroBean.listaParametro}"
paginator="true" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="4,5,7"
style="max-width: 580px; min-width: 550px">
<f:facet name="header">
Parâmetros Integrator
</f:facet>
<p:column style="max-width: 40px; min-width: 40px; overflow: hidden" >
<f:facet name="header">
<h:outputText value="Parametro" />
</f:facet>
<h:outputText value="#{valor.parametro}" />
</p:column>
<p:column style="max-width: 50px; min-width: 50px; overflow: hidden">
<f:facet name="header">
<h:outputText value="Valor" />
</f:facet>
<h:outputText value="#{valor.valor}" />
</p:column>
<p:column style="max-width: 50px; min-width: 50px; overflow: hidden">
<f:facet name="header">
<h:outputText value="Descricão" />
</f:facet>
<h:outputText value="#{valor.desParametro}" />
</p:column>
</p:dataTable>
</h:form>
</f:view>
</h:body>
</html>
The code using template (fileB.xhtml):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/templates/conteudo.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:define name="content">
<p:dataTable id="dataTable2" var="valor" value="#{parametroBean.listaParametro}"
paginator="true" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="4,5,7"
style="max-width: 980px; min-width: 950px">
<f:facet name="header">
Parâmetros Integrator
</f:facet>
<p:column style="max-width: 40px; min-width: 40px; overflow: hidden" >
<f:facet name="header">
<h:outputText value="Parametro" />
</f:facet>
<h:outputText value="#{valor.parametro}" />
</p:column>
<p:column style="max-width: 80px; min-width: 80px; overflow: hidden">
<f:facet name="header">
<h:outputText value="Valor" />
</f:facet>
<h:outputText value="#{valor.valor}" />
</p:column>
<p:column style="max-width: 80px; min-width: 80px; overflow: hidden">
<f:facet name="header">
<h:outputText value="Descricão" />
</f:facet>
<h:outputText value="#{valor.desParametro}" />
</p:column>
</p:dataTable>
</ui:define>
</ui:composition>
Someone can tell me what can be?
Thank you!!!
The error you are getting refers to duplicate IDs in the JSF-generated page. I would check your template
(conteudo.xhtml) for same component IDs (both template and the composite facelet). If you have Firebug or IE developer tools, it might be easier to pinpoint (depending on your browser of usage).