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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Configuring Navigation Rules<br />

450<br />

<br />

#{LogonForm.logon}<br />

failure<br />

/logon.jsp<br />

<br />

<br />

This navigation rule defines the possible ways to navigate from logon.jsp. Each<br />

navigation-case element defines one possible navigation path from logon.jsp. <strong>The</strong> first<br />

navigation-case says that if LogonForm.logon returns an outcome of success, then<br />

storefront.jsp will be accessed. <strong>The</strong> second navigation-case says that logon.jsp will be<br />

re-rendered if LogonForm.logon returns failure.<br />

<strong>The</strong> configuration of an application’s page flow consists of a set of navigation rules. Each rule is<br />

defined by the navigation-rule element in the faces-config.xml file.<br />

<strong>The</strong> navigation rules of the Duke’s Bookstore application are very simple. Here are two complex<br />

navigation rules that could be used with the Duke’s Bookstore application:<br />

<br />

/catalog.jsp<br />

<br />

success<br />

/bookcashier.jsp<br />

<br />

<br />

out of stock<br />

<br />

#{catalog.buy}<br />

<br />

/outofstock.jsp<br />

<br />

<br />

error<br />

/error.jsp<br />

<br />

<br />

<strong>The</strong> first navigation rule in this example says that the application will navigate from<br />

catalog.jsp to<br />

■ bookcashier.jsp if the item ordered is in stock<br />

■ outofstock.jsp if the item is out of stock<br />

<strong>The</strong> second navigation rule says that the application will navigate from any page to error.jsp if<br />

the application encountered an error.<br />

Each navigation-rule element corresponds to one component tree identifier defined by the<br />

optional from-view-id element. This means that each rule defines all the possible ways to<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!