You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Renzo Tomaselli <re...@araxes.it> on 2007/02/27 18:45:03 UTC
[Myfaces] t:saveState semantics
Hi, I use t:saveState throughout many components. Usually it is used
together with some visible elements.
Now I tried to use it for saving some configuration parameters, which
might appear as visible components or not, depending on user choice.
I was fairly surprised to notice that when there is no visible
component, the restoring process is skipped altogether (from my debugger).
E.i.:
<ui:component>
<t:saveState id="selected" value="#{bean.selected}"/>
<c:if test="#{bean.visible}">
<t:commandButton id="cancel" text="#{msg['tableConfig.cancel']}"
action="#{bean.cancel}"/>
...
in such a case, I assumed that proper saving/restoring of saveState
would occur even when visible == false, e.g. no component was rendered.
But I noticed that in this case, method setSelected() is never called
during restore view.
I use Facelets, and other components in the same page are properly
restored, but all of them have some rendered component.
Would a hidden input all I need to force proper handling of saveState or
is there any other trick to account for ?
Thanks -- Renzo
Re: [Myfaces] t:saveState semantics
Posted by Mike Kienenberger <mk...@gmail.com>.
There must be some other reason. t:saveState works on backing beans,
not on components, so that shouldn't be relevent.
However, if your t:saveState component isn't rendered (or is inside
conditional code like c:if) then it won't be used.
On 2/27/07, Renzo Tomaselli <re...@araxes.it> wrote:
> Hi, I use t:saveState throughout many components. Usually it is used
> together with some visible elements.
> Now I tried to use it for saving some configuration parameters, which
> might appear as visible components or not, depending on user choice.
> I was fairly surprised to notice that when there is no visible
> component, the restoring process is skipped altogether (from my debugger).
> E.i.:
>
> <ui:component>
> <t:saveState id="selected" value="#{bean.selected}"/>
> <c:if test="#{bean.visible}">
> <t:commandButton id="cancel" text="#{msg['tableConfig.cancel']}"
> action="#{bean.cancel}"/>
> ...
>
> in such a case, I assumed that proper saving/restoring of saveState
> would occur even when visible == false, e.g. no component was rendered.
> But I noticed that in this case, method setSelected() is never called
> during restore view.
> I use Facelets, and other components in the same page are properly
> restored, but all of them have some rendered component.
> Would a hidden input all I need to force proper handling of saveState or
> is there any other trick to account for ?
> Thanks -- Renzo
>
>