Section 9.1. The JSF Lifecycle


9.1. The JSF Lifecycle

To work within the JSF lifecycle, an application makes an XMLHTTPRequest to a URL that has a JavaServer Faces servlet listening. The JSF request-processing lifecycle consists of the following phases:


Restore view

The view is restored from the request data or the data saved on the server.


Apply request values

The components in the view save their values in the request.


Process validations

The components validate the new values coming from the request.


Update model values

Model properties are updated. The model properties are bound to the components by value bindings.


Invoke application

Event listeners call external methods to process the updated data.


Render response

A response is sent to answer the original request.


Process events

Any events that occurred during the previous phase are handled.

Figure 9-1 shows how a request moves through these phases. It's a simple high-level view of the JavaServer Faces lifecycle, but it illustrates the basic principle. The lifecycle begins with the Restore View phase and finishes with the Render Response phase, but a JSF request does not have to go through every phase of the lifecycle. Each Process Events phase gives the application a chance to handle any events (for example, validation failures) that occurred during the previous phase.

Figure 9-1. The JavaServer Faces lifecycle





Ajax on Java
Ajax on Java
ISBN: 0596101872
EAN: 2147483647
Year: 2007
Pages: 78

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net