Save This Page
Home » tomahawk-1.1.6-src » org.apache.myfaces » custom » savestate » [javadoc | source]
org.apache.myfaces.custom.savestate
public class: UISaveState [javadoc | source]
java.lang.Object
   javax.faces.component.UIParameter
      org.apache.myfaces.custom.savestate.UISaveState
Provides the ability to store a model value inside the view's component tree.

JSF provides three scopes for managed beans and therefore all the model objects that the managed beans reference: request, session, application. However a common requirement is a way for a model object to have a scope that is tied to the duration of the current view; that is longer than the request scope but shorter than session scope.

This component simply holds a reference to an arbitrary object (specified by the value property). Because this object is an ordinary component whose scope is the current view, the reference to the model automatically has that same scope.

When the value is an EL expression, then after the view is restored the recreated target object is stored at the specified location.

The object being saved must either:

Note that the saved object can be "chained" from view to view in order to extend its lifetime from a single view to a sequence of views if desired. A UISaveState component with an EL expression such as "#{someBean}" will save the object state after render, and restore it on postback. If navigation occurs to some other view and that view has a UISaveState component with the same EL expression then the object will simply be saved into the new view, thus extending its lifetime.

Field Summary
public static final  String COMPONENT_TYPE     
public static final  String COMPONENT_FAMILY     
Constructor:
 public UISaveState() 
Method from org.apache.myfaces.custom.savestate.UISaveState Summary:
getFamily,   restoreState,   saveState
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.myfaces.custom.savestate.UISaveState Detail:
 public String getFamily() 
 public  void restoreState(FacesContext context,
    Object state) 
 public Object saveState(FacesContext context)