-
1. Re: Duplicate Id error when using binding on rich:tree
mp911de Feb 22, 2012 11:45 PM (in response to mcfly83)can you post some code?
-
2. Re: Duplicate Id error when using binding on rich:tree
mcfly83 Feb 23, 2012 4:19 AM (in response to mp911de)Sure!
This is basically a tree with different types of nodes:
{code:xml}
<rich:tree ajaxSubmitSelection="true" id="userTree" switchType="ajax" reRender="userAdminDetails" toggleOnClick="false"
value="#{userBean.richtreeData}" binding="#{userBean.richtreeBinding}"
var="item" nodeFace="#{item.objectType}" styleClass="tree">
<rich:componentControl disableDefault="false" event="oncontextmenu" for="iaContextMenu" operation="show" />
<rich:treeNode id="ugNode" type="user-group" reRender="userAdminDetails" nodeSelectListener="#{userBean.expandUserGroup}">
<h:outputText value="#{item.name}" />
<rich:componentControl disableDefault="true" rendered="#{not tab}"
event="oncontextmenu" for="ugContextMenu" operation="show">
<f:param value="#{item.id}" name="selectedUserGroupId" />
</rich:componentControl>
</rich:treeNode>
<rich:treeNode id="iaNode" type="instance-admin" nodeSelectListener="#{userBean.expandUserGroup}">
<h:outputText value="#{item.name}" />
</rich:treeNode>
<rich:treeNode id="doNode" type="data-owner" nodeSelectListener="#{userBean.expandDataOwner}">
<h:outputText value="#{item.name}" />
<rich:componentControl disableDefault="true" rendered="#{not tab}"
event="oncontextmenu" for="doContextMenu" operation="show">
<f:param value="#{item.id}" name="selectedUserGroupId" />
</rich:componentControl>
</rich:treeNode>
<rich:treeNode id="usNode" type="user" nodeSelectListener="#{userBean.expandUser}">
<h:outputText value="#{item.name}" />
</rich:treeNode>
</rich:tree>
<rich:contextMenu rendered="#{not tab}" attachTo="ugNode" id="ugContextMenu" submitMode="ajax">
(...)
</rich:contextMenu>
{code}
Without the binding="#{userBean.richtreeBinding}" everything is working fine, but I need the UITree in my backing bean to expand/collapse nodes from code.
But when I add the binding attribute, I get:
com.sun.facelets.FaceletViewHandler handleRenderException
FATAL: Error Rendering View[/jsf/userView.xhtml]
java.lang.IllegalStateException: duplicate Id for a component userGroupAdminView:userAdminTreeForm:userTree:ugNode
at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:68)
at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)
(...)
I also tried to bind the UITree to a request scoped bean, but the error is the same.