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

Adam Winer updated TOMAHAWK-253:
--------------------------------

    Status: Patch Available  (was: Open)

> Dummy form code must call StateManager.saveSerializedView() for server-side 
> state saving
> ----------------------------------------------------------------------------------------
>
>          Key: TOMAHAWK-253
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-253
>      Project: MyFaces Tomahawk
>         Type: Bug

>     Versions: 1.1.2-SNAPSHOT
>  Environment: Generic issue.
>     Reporter: Adam Winer

>
> The current dummy form code in DummyFormUtils has a block that reads:
>         if (stateManager.isSavingStateInClient(facesContext))
>         {
>             //render state parameters
>             //TODO: Optimize saveSerializedView call, because serialized view 
> is built twice!
>             StateManager.SerializedView serializedView = 
> stateManager.saveSerializedView(facesContext);
>             stateManager.writeState(facesContext, serializedView);
>         }
>         else
>         {
>             writer.startElement(HTML.INPUT_ELEM, null);
>             
> writer.writeAttribute(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.TYPE_ATTR,
>  org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.INPUT_TYPE_HIDDEN, 
> null);
>             writer.writeAttribute(HTML.NAME_ATTR, 
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.SEQUENCE_PARAM, 
> null);
>             
> writer.writeAttribute(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.VALUE_ATTR,
>  
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getViewSequence(facesContext),
>  null);
>             
> writer.endElement(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.INPUT_ELEM);
>         }
> Note that stateManager.saveSerializedView() is only called for client-side 
> state saving.
> This means that the dummy form code never actually gets around to calling 
> stateManager.saveSerializedView(), so unless someone else has called this 
> method, the view never actually gets saved in the session.  This is breaking 
> the latest release of Facelets (1.1.5), which has added optimizations that 
> avoid unnecessary calls to the StateManager.
> Simple fix:   haul 
>             StateManager.SerializedView serializedView = 
> stateManager.saveSerializedView(facesContext);
> ... out of the "if" block.
> Ideally, this code should be refactored so that the server-side code is also 
> calling StateManager.writeState() too - it's a significant problem that 
> DummyFormUtils has hardcoded knowledge of how the StateManager works.

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