I am using JSF Mojarra 2.2 and Primefaces 4.0.
On my page I use <ui:repeat>
to render some dataTables. By clicking on the name column of a single row-element additional information for this row is loaded via ajax and displayed below the tables in a separate panel. The page renders normally and behaves as expected in the beginning. After some clicks and loading additional information via ajax I get:
java.lang.IllegalStateException: Component ID has already been found in the view.
The detailed error message
+id: dcvForm
type: javax.faces.component.html.HtmlForm@19aa202
+id: j_idt34
type: org.primefaces.component.scrollpanel.ScrollPanel@1025e3c
+id: j_idt35
type: org.primefaces.component.outputpanel.OutputPanel@78eb00
+id: j_idt40 <===============
type: com.sun.faces.facelets.component.UIRepeat@194a115
+id: j_idt41
type: org.primefaces.component.datatable.DataTable@db8d63
+id: j_idt42
type: javax.faces.component.html.HtmlOutputText@1f6f6f
+id: j_idt43
type: org.primefaces.component.column.Column@1ccf811
+id: j_idt44
type: javax.faces.component.html.HtmlOutputText@1b22d38
+id: j_idt45
type: javax.faces.component.html.HtmlOutputText@b6cbe4
+id: j_idt46
type: org.primefaces.component.column.Column@103f78a
+id: j_idt47
type: javax.faces.component.html.HtmlOutputText@1708cb9
+id: j_idt48
type: javax.faces.component.html.HtmlOutputText@26ed67
+id: j_idt49
type: org.primefaces.component.column.Column@1ac1194
+id: j_idt50
type: javax.faces.component.html.HtmlOutputText@1b61dd7
+id: j_idt51
type: javax.faces.component.html.HtmlOutputText@1614aa1
+id: j_idt52
type: org.primefaces.component.column.Column@6a93d0
+id: j_idt53
type: javax.faces.component.html.HtmlOutputText@10e3ef3
+id: j_idt54
type: javax.faces.component.html.HtmlOutputText@46fd81
+id: j_idt55
type: org.primefaces.component.column.Column@ad5082
+id: j_idt56
type: javax.faces.component.html.HtmlOutputText@808a3a
+id: j_idt57
type: javax.faces.component.html.HtmlOutputText@f31547
+id: j_idt40 <===============
type: com.sun.faces.facelets.component.UIRepeat@fa2760
+id: j_idt41
type: org.primefaces.component.datatable.DataTable@12f4785
+id: j_idt42
type: javax.faces.component.html.HtmlOutputText@1007ab4
+id: j_idt43
type: org.primefaces.component.column.Column@77deb5
+id: j_idt44
type: javax.faces.component.html.HtmlOutputText@1be73ae
+id: j_idt45
type: javax.faces.component.html.HtmlOutputText@9cd7aa
+id: j_idt46
type: org.primefaces.component.column.Column@113119b
+id: j_idt47
type: javax.faces.component.html.HtmlOutputText@e8ee3b
+id: j_idt48
type: javax.faces.component.html.HtmlOutputText@7083c1
+id: j_idt49
type: org.primefaces.component.column.Column@da0bb8
+id: j_idt50
type: javax.faces.component.html.HtmlOutputText@1378ca7
+id: j_idt51
type: javax.faces.component.html.HtmlOutputText@1f360fc
+id: j_idt52
type: org.primefaces.component.column.Column@16454e1
+id: j_idt53
type: javax.faces.component.html.HtmlOutputText@aea7
+id: j_idt54
type: javax.faces.component.html.HtmlOutputText@ca6240
+id: j_idt55
type: org.primefaces.component.column.Column@f8833d
+id: j_idt56
type: javax.faces.component.html.HtmlOutputText@17033ef
+id: j_idt57
type: javax.faces.component.html.HtmlOutputText@161bdc8
+id: j_idt36
type: org.primefaces.component.datatable.DataTable@8c5a93
+id: j_idt37
type: javax.faces.component.html.HtmlOutputText@8ea6b9
+id: j_idt38
type: org.primefaces.component.column.Column@163dfdf
+id: j_idt39
type: javax.faces.component.html.HtmlOutputText@1fec9fc
+id: ElementName
type: org.primefaces.component.commandlink.CommandLink@7edb15
+id: ceIndex
type: javax.faces.component.html.HtmlInputHidden@617652
+id: j_idt40
type: com.sun.faces.facelets.component.UIRepeat@9f1948
+id: j_idt41
type: org.primefaces.component.datatable.DataTable@134c649
+id: j_idt42
type: javax.faces.component.html.HtmlOutputText@1c60a38
+id: j_idt43
type: org.primefaces.component.column.Column@c9054a
+id: j_idt44
type: javax.faces.component.html.HtmlOutputText@17a7e4d
+id: j_idt45
type: javax.faces.component.html.HtmlOutputText@fa11ca
+id: j_idt46
type: org.primefaces.component.column.Column@1a5e64c
+id: j_idt47
type: javax.faces.component.html.HtmlOutputText@b2c0d7
+id: j_idt48
type: javax.faces.component.html.HtmlOutputText@1929f1c
+id: j_idt49
type: org.primefaces.component.column.Column@10be919
+id: j_idt50
type: javax.faces.component.html.HtmlOutputText@f47006
+id: j_idt51
type: javax.faces.component.html.HtmlOutputText@1e6c683
+id: j_idt52
type: org.primefaces.component.column.Column@1f2e85c
+id: j_idt53
type: javax.faces.component.html.HtmlOutputText@7517ff
+id: j_idt54
type: javax.faces.component.html.HtmlOutputText@17a69a8
+id: j_idt55
type: org.primefaces.component.column.Column@1aececc
+id: j_idt56
type: javax.faces.component.html.HtmlOutputText@18ac146
+id: j_idt57
type: javax.faces.component.html.HtmlOutputText@9714e6
+id: j_idt58
type:
<p/>
+id: filterInfoPanel
type: org.primefaces.component.outputpanel.OutputPanel@dd2f52
+id: j_idt59
type: com.sun.faces.facelets.component.UIRepeat@14ddafe
+id: j_idt60
type: org.primefaces.component.outputpanel.OutputPanel@64760f
+id: j_idt61
type: javax.faces.component.html.HtmlOutputLabel@183001f
+id: j_idt62
type:
<p/>
+id: j_idt63
type: javax.faces.component.html.HtmlOutputLabel@17d098a
+id: ajaxStatusPanel
type: org.primefaces.component.ajaxstatus.AjaxStatus@1fd5640
+id: j_idt64
type: javax.faces.component.html.HtmlGraphicImage@1299e6a
+id: j_idt65
type: javax.faces.component.html.HtmlGraphicImage@15f6084
+id: j_idt66
type:
</div>
My xhtml page
<ui:define name="content">
<h:form id="dcvForm">
<p:scrollPanel mode="native">
<p:outputPanel style="white-space: nowrap;">
<p:dataTable var="rowElement" binding="#{nameTable}"
value="#{domainComparisonBean.firstDomainElements}"
style="display:inline-block;">
[...]
<p:commandLink id="ElementName" value="#{rowElement.name}"
actionListener="#{domainComparisonBean.mouseOver}"
update=":dcvForm:filterInfoPanel" ajax="true" >
</p:commandLink>
[...]
</p:dataTable>
<ui:repeat var="domain" value="#{domainComparisonBean.domainData}"
varStatus="status">
<p:dataTable var="rowElement" value="#{domain.rowData}"
style="display:inline-block;" selectionMode="single"
selection="#{domainComparisonBean.selectedRow}">
[...]
</p:dataTable>
</ui:repeat>
</p:outputPanel>
</p:scrollPanel>
<p />
<p:outputPanel id="filterInfoPanel"
style="border:none; margin-left:10px;">
<ui:repeat var="filter"
value="#{domainComparisonBean.currentFilters}" varStatus="status">
[...]
</ui:repeat>
</p:outputPanel>
</h:form>
</ui:define>
It seems that by mistake the <ui:repeat>
is inserted multiple times with the same id into the document tree.
The problem only occurs in combination with ajax functionality. If I set ajax="false"
in my <p:commandLink>
I do not get any errors.
Please help me understand why this happens and how to avoid it!
As stated by BalusC in the comments, I used <p:dataList type="none">
to replace <ui:repeat>
which solves the error.