Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

As part of this approach, we've implemented an invisible JSF component to glue the JSP page and the backing bean together. It's called "gbx:flowState". This is from the JavaDoc:

This JSF UI component lets backing beans track the request life cycle and save their state within the component tree itself. (These two aspects could be separated with a "saveState" Boolean attribute if we ever need to let a session-scoped bean track the request life cycle.)

Like the MyFaces x:saveState tag, this passes the bean's state from request to request without use of session scope. That in turn enables request-thread functionality such as "what if?" scenarios and multiple active application views from a single session.

Usage:

<gbx:flowState bean="#{phaseAwareBean}" />

should be placed in the JSP file before any other bean references are made.

The bean must implement the PhaseAware interface and be serializable. Any non-transient fields in the bean will be saved and restored from this component.

The PhaseAware interface is used to alert the backing bean at key phase transitions. All our page backing beans subclass InitializableBean, which uses this interface to do two things:

  • Initialize the bean (usually loading from the DB) before any other rendering is done.
  • Note when validation failed, in case that should influence the bean's data loading.
  • No labels