10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Backing Beans<br />

calls the action method referenced by the component that triggered the event. <strong>The</strong> action<br />

method returns a logical outcome to the action listener.<br />

<strong>The</strong> listener passes the logical outcome and a reference to the action method that produced the<br />

outcome to the default NavigationHandler. <strong>The</strong> NavigationHandler selects the page to<br />

display next by matching the outcome or the action method reference against the navigation<br />

rules in the application configuration resource file by the following process:<br />

1. <strong>The</strong> NavigationHandler selects the navigation rule that matches the page currently<br />

displayed.<br />

2. It matches the outcome or the action method reference it received from the default<br />

ActionListener with those defined by the navigation cases.<br />

3. It tries to match both the method reference and the outcome against the same navigation<br />

case.<br />

4. If the previous step fails, the navigation handler attempts to match the outcome.<br />

5. Finally, the navigation handler attempts to match the action method reference if the<br />

previous two attempts failed.<br />

When the NavigationHandler achieves a match, the render response phase begins. During this<br />

phase, the page selected by the NavigationHandler will be rendered.<br />

For more information on how to define navigation rules, see “Configuring Navigation Rules”<br />

on page 449.<br />

For more information on how to implement action methods to handle navigation, see “Writing<br />

a Method to Handle an Action Event” on page 404.<br />

For more information on how to reference outcomes or action methods from component tags,<br />

see “Referencing a Method That Performs Navigation” on page 369.<br />

A typical <strong>Java</strong>Server Faces application includes one or more backing beans, each of which is a<br />

<strong>Java</strong>Server Faces managed bean that is associated with the UI components used in a particular<br />

page. Managed beans are <strong>Java</strong>Beans components (see “<strong>Java</strong>Beans Components” on page 165)<br />

that you can configure using the managed bean facility, which is described in “Configuring<br />

Beans” on page 436. This section introduces the basic concepts on creating, configuring, and<br />

using backing beans in an application.<br />

Creating a Backing Bean Class<br />

Backing Beans<br />

In addition to defining a no-arg constructor, as all <strong>Java</strong>Beans components must do, a backing<br />

bean class also defines a set of UI component properties and possibly a set of methods that<br />

perform functions for a component.<br />

Chapter 10 • <strong>Java</strong>Server FacesTechnology 307

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!