Mario Ivankovits wrote:
So my next guess is: I use saveState and then the bean isnt generated through the managed bean facility and thus no managed property configuration will be processed.
I'll look in this direction.
Ok, it IS saveState.
If you saveState, but left out (transient) those members which are set through managed-property those members are no reset.

I use a "context" bean which is set on my beans using
       <managed-property>
           <property-name>shopContext</property-name>
           <value>#{prShopContext}</value>
       </managed-property>

In saveState this "shopContext" should not be saved nor restored (thus transient), but should be set using the default myFaces factories. I think it is not possible to fix saveState to reinitialize the bean as values set by <managed-property might only be the "default value" and can be overwritten by the bean.
Thus, it cant know if a managedProperty should be reset or not.

The object should be created throug myFaces, and its state restored onto this object. As far as I know this is only possible if one implement something like saveState() and restoreState(), but this is error prone.

Another solution can be to not directly save the bean but a inner class instance which holds the state.

public class MyBean
{
   public static class State implements Serializable
   {
       private String needSave;
   }

   private String transientNotSaved;
}

and use saveState that way:
<x:saveState value="#{myBean.state}" />

Then myBean is create through myFaces and the "state" restored through saveState.

I can add this "trap" to the wiki if you find this information important enough.

---
Mario

Reply via email to