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

Howard Abrams updated MYFACES-833:
----------------------------------

    Fix Version: 1.1.3

> HtmlFormRendererBase saves form state before components have been rendered - 
> breaks auto id generation
> ------------------------------------------------------------------------------------------------------
>
>          Key: MYFACES-833
>          URL: http://issues.apache.org/jira/browse/MYFACES-833
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.1.0
>  Environment: Sun JDK 1.5
> Windows XP
> Facelets 1.0d/1.0e
> Tomcat 5.x
>     Reporter: Max Muermann
>      Fix For: 1.1.3
>  Attachments: HtmlFormRendererBase.java.diff
>
> In HtmlFormRendererBase, the following code is executed in the encodeBegin() 
> method:
> //write state marker at the beginning of the form
> ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
> viewHandler.writeState(facesContext);
> This causes problems (especially when using facelets), as some components 
> first call getClientId() - which causes a new id for the component to be 
> generated by the ViewRoot - in their own encodeBegin() method.
> If this is the case, as the form encodeBegin() is called before any of its 
> child components are rendered, those components that do not yet have an id 
> assigned save their state with a null id. When the view state is restored in 
> the next request, these ids will be regenerated, starting with _id0. However, 
> if there are other components in the page that also require autogenerated 
> ids, some ids will be duplicated and the "problem" components will receive 
> different ids to when they were first rendered.
> Attached is a patch to HtmlFormRendererBase which moves the state saving 
> operation of the form to the encodeEnd() method, where all child components 
> will have been rendered and therefore will have called getClientId() at least 
> once.

-- 
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

Reply via email to