You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Strecker, Mark" <pe...@ugs.com> on 2005/09/08 17:14:20 UTC

Can't get x:saveState to work

Hello All,

   We are having problems getting x:saveState(or for that matter using
Tomahawk's t:saveState) to work in the scenario where a bean's values
are persisted from one page to the next. I made a simple test app where
page1 and page2 are identical. I set a value in the page1's form, submit
it, then go to page2 and the values are gone.
   I have seen many posts saying that this should work and that people
are using this, but we need some help figuring out what we did wrong.

TIA,
Mark

Here are my files :
 <<Test.jsp>>  <<Test2.jsp>>  <<faces-config.xml>>  <<web.xml>>  
<<TestForm.java>> 

Re: Can't get x:saveState to work

Posted by Mike Kienenberger <mk...@gmail.com>.
That looks like it should work to me too.  I've pulled out the pieces
that are most relevent and put them into a more readable form, which
might make it more likely that someone else will take a look.

There's no redirect set on the navigate case, the bean is
request-scoped, and your saveState components are inside an f:view
tag.

Test.jsp
    <f:view>
        <t:saveState value="#{MjsBean}"/>
        <h:form id="testForm">
            <h:inputText id="userName" value="#{MjsBean.mjsVal}"/>
            <p>
            <h:commandButton value="Submit" action="#{MjsBean.processSubmit}"/>

Test2.jsp
    <f:view>
        <t:saveState value="#{MjsBean}"/>
        <h:form id="testForm">
            <h:inputText id="userName" value="#{MjsBean.mjsVal}"/>

TestForm.java:
    public String processSubmit()  { return "success"; }

faces-config.xml:
    <managed-bean>
        <managed-bean-name>Mjs2Bean</managed-bean-name>
        <managed-bean-class>com.ugs.plm.davetest.TestForm</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
        <from-view-id>/Test.jsp</from-view-id>
        <navigation-case>
            <to-view-id>/Test2.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

On 9/8/05, Strecker, Mark <pe...@ugs.com> wrote:
>  
> 
> Hello All, 
> 
>    We are having problems getting x:saveState(or for that matter using
> Tomahawk's t:saveState) to work in the scenario where a bean's values are
> persisted from one page to the next. I made a simple test app where page1
> and page2 are identical. I set a value in the page1's form, submit it, then
> go to page2 and the values are gone. 
> 
>    I have seen many posts saying that this should work and that people are
> using this, but we need some help figuring out what we did wrong. 
> 
> TIA, 
> Mark 
> 
> Here are my files : 
>  <<Test.jsp>> <<Test2.jsp>> <<faces-config.xml>> <<web.xml>>
> <<TestForm.java>> 
>