background image

Update Model Values Phase

<< Process Validations Phase | Render Response Phase >>
<< Process Validations Phase | Render Response Phase >>

Update Model Values Phase

Update Model Values Phase
After the JavaServer Faces implementation determines that the data is valid, it can walk the
component tree and set the corresponding server-side object properties to the components'
local values. The JavaServer Faces implementation will update only the bean properties pointed
at by an input component's value attribute. If the local data cannot be converted to the types
specified by the bean properties, the life cycle advances directly to the render response phase so
that the page is re-rendered with errors displayed. This is similar to what happens with
validation errors.
If any updateModels methods or any listeners called renderResponse on the current
FacesContext
instance, the JavaServer Faces implementation skips to the render response
phase.
At this point, if the application needs to redirect to a different web application resource or
generate a response that does not contain any JavaServer Faces components, it can call
FacesContext.responseComplete
.
If events have been queued during this phase, the JavaServer Faces implementation broadcasts
them to interested listeners.
At this stage, the userNo property of the UserNumberBean is set to the local value of the
userNumber
component.
Invoke Application Phase
During this phase, the JavaServer Faces implementation handles any application-level events,
such as submitting a form or linking to another page.
At this point, if the application needs to redirect to a different web application resource or
generate a response that does not contain any JavaServer Faces components, it can call
FacesContext.responseComplete
.
If the view being processed was reconstructed from state information from a previous request
and if a component has fired an event, these events are broadcast to interested listeners.
The greeting.jsp page from the guessNumber example has one application-level event
associated with the UICommand component. When processing this event, a default
ActionListener
implementation retrieves the outcome, success, from the component's
action
attribute. The listener passes the outcome to the default NavigationHandler. The
NavigationHandler
matches the outcome to the proper navigation rule defined in the
application's application configuration resource file to determine which page needs to be
displayed next. See
"Configuring Navigation Rules" on page 451
for more information on
managing page navigation. The JavaServer Faces implementation then sets the response view to
that of the new page. Finally, the JavaServer Faces implementation transfers control to the
render response phase.
The Life Cycle of a JavaServer Faces Page
Chapter 10 · JavaServer Faces Technology
317