All,
I've run into what appears to be a bug in the new state saving/restoring
code for facelets.
I've got a simple xhtml page with a one field form and a value change
listener attached. The listener simply outputs the old value and the
new value to SystemOut. On every postback, its showing the old value as
what was originally set by the 'value' attribute and not the value from
the previous request as would be expected.
<h:form id="form1">
<h:commandButton value="Press here" id="testListeners" />
<h:inputText id="testValueChangeListener" value="some text">
<f:valueChangeListener
binding="#{coreTagsBean.testValueChangeListener}"
type="listener.TestValueChangeListener" />
</h:inputText>
</h:form>
I stepped through the code in the debugger, and when we get into
DefaultFaceletsStateManagementStrategy.restoreView(), the states are
always coming up null in the return object array returned form the
HtmlResponseStateManager from this code snippet (lines 160-161 in my view)
state = (Object[]) manager.getState (context, viewId);
states = (Map<String, Object>) state[1];
Since states is null, when we execute restoreStateFromMap(), we don't
ever execute the restoreState() method on the component since we have
not recovered the state data.
I've stepped through the code for state saving, and it looks to me as
though the state data for the input text field is being saved properly,
but I'm not very familiar with how the state saving/restoring code
works. I'd be happy to continue doing the debugging if someone could
point me in the right direction, but I would appreciate any help from
those in the community who are more familiar with the state management
code.
Thanks,
Mike