In my JSF 2 based application I have a form that includes (amongst other UI components) some checkboxes.
On the checkboxes I have registered ajax requests that fire when they are checked. The ajax requests will actually just update the value of another checkbox in the backing bean. As a result the other checkbox will also be checked (when it gets re-rendered - as it will take the updated value from the backing bean in the render response phase).
This works fine until the whole form gets submitted and validation errors occur.
Then the ajax requests still work and change the value on the backing bean but in the phase of re-rendering the updated checkbox the value for it is not taken from the backing bean but from a cached value that is taken from a ComponentStateHelper
class.
As far as I understand this is used for the new feature of JSF 2 to only store partial changes to the component tree.
What I do not understand is: How is this related to the validation phase? Why is there a cached value in the StateHelper
class for my checkbox when the validation found errors?
FullAjaxExceptionHandlerFactory
). So it was easy to just include theResetInputAjaxActionListener
in myfaces-config.xml
file. But this is only called in theInvokeApplicationPhase
which is not hit by my ajax request. My ajax request is triggered by a<h:selectBooleanCheckbox>
and in there by<f:ajax render="@this">
. But I will have a closer look at this. I just quickly tried your suggestion. – Protactinium