Thanks for your help Dennis. I created a new issue (TOMAHAWK-509) describing this problem.

Dennis Byrne wrote:
Matt,

Can you please make some noise in the issue tracker on this?  Please mark this 
as a enhancement ( someone has to add StateHolder functinality ) and not a bug 
( someone will just remove a few javadoc lines ).

Thanks.

Dennis Byrne

-----Original Message-----
From: Matt Hughes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 29, 2006 02:00 PM
To: 'MyFaces Discussion'
Subject: Re: t:saveState and StateHolder

Again, it would be of great value to me. FYI, it says in the Tomahawk JavaDocs that StateHolder is supported: http://myfaces.apache.org/tomahawk/apidocs/org/apache/myfaces/custom/savestate/UISaveState.html

Dennis Byrne wrote:
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