First page Back Continue Last page Graphics

Defining Navigation by Using the JSF Controller


Defining Navigation by Using the JSF Controller

In JavaServer Faces, navigation between application pages is not hard coded in the file but is defined by a set of rules that are centrally defined in the faces-config.xml file. Navigation rules determine the next page to display when a user clicks a navigation component, such as a button or a hyperlink.

A navigation rule defines the navigation from one page to one or more other pages. Each navigation rule can have one or more cases, which define where a user can go from that page. For example, if a page has links to several other pages in the application, you can create a single navigation rule for that page and one navigation case for each link to the different pages. The rule itself can define the navigation from:

A specific JSF page

All pages whose paths match a specified pattern, such as all the pages in one directory, which is called a pattern-based rule

All pages in a Java EE Web application, which is called a global navigation rule