Note this blog is obsolete, see for the current blog 

The definition of a StateHolder according to the StateHolder interface:

  boolean isTransient()
  void restoreState(FacesContext context, Object state)

  Object saveState(FacesContext context)
  void setTransient(boolean newTransient)

Each of the methods mentioned above have a particular role to fulfill during the JSF lifecycle.

Transient or not 

The setTransient method can be used to state whether or not this StateHolder participates in state saving (true) or not (false). The isTransientmethod can be used to inspect that.

Save and restore 

The saveState method is called by the runtime to save the StateHolder. Note the return value of this method should be Serializable. TherestoreState method is called by the runtime to restore the StateHolder.

  boolean isTransient() {
    return transientFlag;

  void restoreState(FacesContext context, Object state) {
    getAttributes().put("test", (String) state);

  Object saveState(FacesContext context) {
    Object state = (Object) getAttributes().get("test");

  void setTransient(boolean newTransient) {
    transientFlag = newTransient;


The restoreState and saveState methods are tightly coupled and as such should be called within the same call hierarchy.