The saveState component does not do a StateHolder check.  If you want this 
functionality it would be a pretty simple patch.  Any takers?

Dennis Byrne

>-----Original Message-----
>From: Matt Hughes [mailto:[EMAIL PROTECTED]
>Sent: Thursday, June 29, 2006 01:50 PM
>To: 'MyFaces Discussion'
>Subject: t:saveState and StateHolder
>
>I am experiencing a bit of a problem with using t:saveState.  Up until 
>now, I've always just made the bean that I was saving Serializable; but 
>today I came across a situation where I wanted more control over what 
>parts of the bean were actually saved. 
>
>My code follows.  Basically, I have a backing bean with a field that 
>implements StateHolder.  I try to saveState just that field:
>
><t:saveState value="#{backingBean.fooBar}" />
>
>When FooBar just implemented Serializable, it got saved and restored 
>fine.  When I changed FooBar to implement StateHolder, the 
>saveState/restoreState methods never got called.  Am I missing something?
>
>/** BACKING BEAN **/
>public class BackingBean {
>    private FooBar fooBar;
>
>    public FooBar getFooBar()
>    {
>        return fooBar;
>    }
>
>    public void setFooBar(FooBar fooBar)
>    {
>        this.fooBar = fooBar;
>    }
>}
>
>class FooBar implements StateHolder
>{
>
>    public Object saveState(FacesContext context)
>    {
>        System.out.println("Saving state");
>        return null;
>    }
>
>    public void restoreState(FacesContext context, Object state)
>    {
>        System.out.println("Restoring state");
>    }
>
>    public boolean isTransient()
>    {
>        return false;
>    }
>
>    public void setTransient(boolean newTransientValue)
>    {
>    }
>}
>
>


Reply via email to