Hello,
I just learned there's a subtle but important difference between
<h:inputHidden value="#{bean.foo}"/> and <t:saveState
value="#{bean.foo}"/>, assuming bean.foo is a String property.
inputHidden and saveState look very similar and they have the same end
result of setting bean.foo, but they get applied at different phases of
the JSF lifecycle. <t:saveState> is during Restore View phase,
<h:inputHidden> is during Apply Request Values.
This is an important distinction if you have something like
<h:commandLink rendered="#{bean.foo}">--I was very confused when my
commandLink action wasn't executed, yet the link was still displayed.
the other lesson learned is that the 'rendered' attribute is actually
evaluated twice, once in Restore View to decide whether the
commandLink/Button you clicked on should actually run the action; and a
separate time during Render Response to decide whether to show the link
again.
Hope that sharing this spares others the confusion I had trying to get
my code to work.
-- Bill
- h:inputHidden vs t:saveState explained Bill Schneider
-