JSF Tip #20 - The JSF State Saving APIs

Since state saving happens as part of the JSF lifecycle a component, validator, converter, etcetera that wants to participate in state saving can do so by implementing or using one or all of the below mentioned APIs.

  1. StateHolder
  2. PartialStateHolder
  3. StateHelper

StateHolder

This is the original API that a component needs to implement if it wants to participate in what is now considered full state saving. Under this API all the state is saved, no optimization is done.

PartialStateHolder

This is the API that was added to support what is now called partial state saving. Note this API is an extension of the above API and as such the methods of the above mentioned API still need to be implemented. When a component developer implements this API he/she is indicating that the component is capable of both supporting the original API and this API. The methods of the PartialStateHolder API allow the component developer to optimize the amount of state that is being saved.

StateHelper

This API was added to facilitate component developers implementing partial state saving.

Each of the APIs will be covered in subsequent blog entries. Stay tuned!

Posted October 16, 2012

Up