Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1.2-SNAPSHOT
-
None
-
None
-
Generic issue.
Description
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.