[richfaces-issues] [JBoss JIRA] Commented: (RF-8223) ExtendedDataTable duplicate Id exception

Alex Kolonitsky (JIRA) jira-events at lists.jboss.org
Thu Dec 17 11:07:30 EST 2009


    [ https://jira.jboss.org/jira/browse/RF-8223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12500587#action_12500587 ] 

Alex Kolonitsky commented on RF-8223:
-------------------------------------

The problem explanation:

1) when jsf-facelets is rendering page, it sets id="j_id3" to the column using root.createUniqueId()

ComponentHandler.apply(...) {
                ...
                UIViewRoot root = ComponentSupport.getViewRoot(ctx, parent);
                if (root != null) {
                    String uid = root.createUniqueId();
                    c.setId(uid);
                }
                ...
}

2) ExtendedDataTable has an inner ContextMenu component, and when ExtendedDataTable is rendering the ContextMenu they invoke clientId for ContextMenu

AbstractExtendedTableRenderer.encodeTableMenu(...) {
...
String menuId = menuRenderer.renderMenu(context, table, col);
...
}

3) but for jsf 2.0 the getClientId() method was overriden

from 
UIComponentBase.getClientId(FacesContext context) {
                ...
                setId(context.getViewRoot().createUniqueId());
                ...
}

to 
UIComponentBase.getClientId(FacesContext context) {
                ...
                String generatedId;
                if (null != namingContainerAncestor &&
                    namingContainerAncestor instanceof UniqueIdVendor) {
                    generatedId = ((UniqueIdVendor)namingContainerAncestor).createUniqueId(context, null);
                }
                else {
                    generatedId = context.getViewRoot().createUniqueId();
                }
                setId(generatedId);
                ...
}

4) and now UIData (and UIExtendedDataTable) is a UniqueIdVendor.

So for ContextMenu we have UniqueId only in UIExtendedDataTable but this id conflicts with components id which is generated by ComponentHandler

> ExtendedDataTable duplicate Id exception
> ----------------------------------------
>
>                 Key: RF-8223
>                 URL: https://jira.jboss.org/jira/browse/RF-8223
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: JSF 2.0
>            Reporter: Alex Kolonitsky
>            Assignee: Alex Kolonitsky
>
> For example below
> <f:view>
>     <h:form id="form">
>         <rich:extendedDataTable id="table">
>             <rich:column >Hello</rich:column>
>         </rich:extendedDataTable>
>     </h:form>
> </f:view>
> I have an exception 
> java.lang.IllegalStateException: duplicate Id for a component form:table:j_id3
> 	org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:68)
> 	org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)
> 	org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)
> 	org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)
> 	org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)
> 	org.ajax4jsf.application.AjaxStateManager.getTreeStructureToSave(AjaxStateManager.java:194)
> 	org.ajax4jsf.application.AjaxStateManager.buildViewState(AjaxStateManager.java:520)
> 	org.ajax4jsf.application.AjaxStateManager.saveSerializedView(AjaxStateManager.java:473)
> 	com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:615)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list