First page Back Continue Last page Graphics

Formal Phases of the JSF Life Cycle


Notes:

Formal Phases of the JSF Life Cycle

The life cycle handles both initial requests and postbacks.

When a user makes an initial request for a page, the life cycle executes only the Restore View and Render Response phases, because there is no user input or actions to process. So the life cycle builds the UI tree from the view, and then renders the view, returning a response to the user and saving the view tree for future requests in the FacesContext object. All the component tags, event handlers, converters, and validators on the page have access to the FacesContext instance.

When a user executes a postback, a form is submitted that is contained on a page that was previously loaded into the browser as a result of executing an initial request. When the life cycle handles a postback, it restores the view based on the data saved on the server, and then executes the following additional phases:

Apply Request Values: Values provided in components that hold a value (such as input fields) have their values applied to their counterparts in the view tree. All events such as ValueChangeEvents (VCE) or ActionEvents (AE) are queued. A VCE means that a value has changed for a specific UI component. An AE means that a button (or any UI component that is a source of an action) was clicked. If a component has its immediate attribute set to true, then validation, conversion, and events associated with the component are processed during this phase.