HTML and CSS Reference
In-Depth Information
In this phase, the navigation is performed by the JSF NavigationHandler after executing the custom action code.
The action attribute can be set to a literal value. In the firstApplication , you already see a case where the action
attribute is set to a literal value:
<h:commandButton value="#{bundle['application.login']}" action="welcome">
</h:commandButton>
In the literal value case, the JSF runtime directly passes the "welcome" literal value to the JSF NavigationHandler
in order to navigate to the new page. The navigation handling results are displayed in the “Render Response” phase.
If an action outcome is not matching a navigation case implicitly (the outcome matching an existing page name) or
explicitly (by matching a navigation rule defined in the faces-config ), the NavigationHandler stays on the same page.
In order to perform the “Invoke application” phase, the JSF runtime calls the processApplication() method
of the UIViewRoot , which broadcasts the queued events to the UICommand components (or any other UIComponent that
implements the ActionSource interface or ActionSource2 interface [which was introduced in JSF 1.2]) by calling the
broadcast(FacesEvent event) method of the UIComponent . the broadcast method broadcasts the action event to all
of the action listeners registered to this event type for processing.
Note
Render Response
Finally, the “Render Response” phase is called by the JSF runtime in order to render the final results to the user. The
UI components tree is rendered to the client by calling the encodeXXX() methods on every component (the encode
methods are responsible for generating the suitable markup for every component).
Adding to the rendering, the “Render Response” phase also stores the state of the UI components tree in the view
state in order to be restored in the next requests.
The Immediate Attribute
Sometimes, you can have situations in your JSF application in which you want to skip the conversion and the
validation in order to navigate to another page. For example, let's assume that in the favorites.xhtml page, you want
to have a "Go Home" button that navigates to an index page "index.xhtml" as follows:
<h:form id="favForm">
...
<h:inputText id="favoriteFood"
value="#{favorite.food}"
required="true">
</h:inputText>
... <!-- other required fields -->
<h:commandButton value="Save my favorites" action="#{favorite.save}"/>
<h:commandButton value="Go home" action="index"/>
</h:form>
 
 
Search WWH ::




Custom Search