Java Reference
In-Depth Information
Phase 5: Invoke Application
During this phase, the JSF runtime processes the application events by executing the corresponding
event listeners. When the user submits a form, the JSF FacesServlet generates an application event
that returns an outcome string that is passed to the navigation handler. The navigation handler looks
up the next page to be rendered.
Phase 6: Render Response
In this phase, each component in the component tree renders itself, and the state of the response
is saved so that the FacesServlet can access it during the Restore View phase, which will occur if
subsequent requests are made to the same page.
Let's look behind the scenes of the Hello World application from the viewpoint of the request-
processing life cycle.
1.
The browser first connects to http://localhost:8080/helloWorldJSF/form.faces .
2.
The JSF implementation initializes the JSF code and reads the form.xhtml
page. That page contains tags, such as h:form , h:inputText , and
h: commandButton . Each tag has an associated tag handler class. When the
page is read, the tag handler class associated with each tag is executed, and
a component tree is constructed. This is the first phase: Restore View. Since
this is the first request and the component tree does not already exist, a new
but empty component tree is created instead of restoring the component
tree. Figure 6-15 shows the component tree for the code fragment of the
form.xhtml file in Listing 6-1.
<h:form>
<h:inputText value="#{helloBean.name}"></h:inputText>
<h:commandButton value="Submit" action="hello"></h:commandButton>
</h:form>
UIForm
UICommand
UIInput
Figure 6-15. The component tree of form.xhtml
 
Search WWH ::




Custom Search