You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Paul Klaer (JIRA)" <de...@myfaces.apache.org> on 2005/12/07 14:07:08 UTC

[jira] Updated: (MYFACES-857) Duplicate id in subview

     [ http://issues.apache.org/jira/browse/MYFACES-857?page=all ]

Paul Klaer updated MYFACES-857:
-------------------------------

    Attachment: MYFACES-857.patch

Its not the problem that the ids are generated after the JspStateManagerImp.restoreTreeStructure is called.

We had the same problem with duplicate ids. After some debugging I found the main problem. The problem is due to component bindings and session scope backing beans. If a binding is set and the view root changes then the old component, which has a binding to a backing bean and doesn't belong to the new viewRoot, is still added.

This components have already generated ids out of the previous rendering as they are not considered in the new rendering phase. The create component method doesn't assing to them new unique ids and the unique ids are broken if the amount of components changes. Thats why the checkForDuplicateIds method finds duplicate ids and raises this error.

There is a second effect on this bug. If you have value bindings and session scope backing beans and you reload the page while modifing the component values then the new component values are not set because the value binding sets the binding values which don't belong to the new viewRoot and the old values are shown again.

We solved the bug on the ApplicationImpl createComponent method. There we check each component if it belongs to the same viewRoot object on the context.

> Duplicate id in subview
> -----------------------
>
>          Key: MYFACES-857
>          URL: http://issues.apache.org/jira/browse/MYFACES-857
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.1.1
>  Environment: Windows XP, Browser IE, Mozilla, Tomcat 5.0.28
>     Reporter: Juergen Melzer
>  Attachments: MYFACES-857.patch
>
> We use tiles and the myfaces integration. 
> But we get an exception:
> javax.faces.FacesException: cannot add component with id '_id13' and path : {Component-Path : [Class: javax.faces.component.html.HtmlPanelGrid,Id: _id13]} to its parent component. This might be a problem due to duplicate ids.
> at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:401)
> at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:219)
> I think the problem is that the id is generated after the JspStateManagerImp.restoreTreeStructure is called. But inside the view there is still the id above.
> A possible solution is to restore the field _uniqueIdCounter of the class UIViewRoot to make correct counting...

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