Implementing state management with the web UI framework

When you install the application that uses the Web UI Framework, a default implementation of state management is provided.

In the Ext JS JavaScript framework, Ext.state.Provider is the abstract base class for state provider implementations. This class provides methods for encoding and decoding typed variables, including dates and definitions of the Provider interface.

If you want to provide your own implementation of state management, the Ext.state.CookieProvider class has an example of this implementation.

The state is saved periodically by posting the data to a servlet, which in turn delegates the task to a class that is specified in the web.xml file. The UI framework defines an interface which the class in the web.xml file needs to implement.

The default state provider works along with the Ext library in the following manner:
  • Local caching of component states, for faster retrieval on subsequent actions.
    Note: This might not be useful for multiple page applications.
  • Saves the available/changed state into the database on page unload. This assumes that the session timeout has not occurred.
  • The Ext library automatically calls the get state method for all components which are state-aware.
  • The Ext library automatically calls the set state method whenever the state changes for a component.

By default, the state management implementation is not registered with the Ext JS library. The implementation needs to be registered by the application. This provides flexibility if the application does not require the UI state to be persisted.