HTML and CSS Reference
The previous example means that the navigation cases will be applied only to all the pages under the common
folder by using the /common/* pattern.
The default behavior of the rule-based navigation is forwarding the request to the target page; however, it is also
possible to change this behavior by using an HTTP Redirect instead. Listing 2-33 shows how to make the navigations
using the HTTP Redirect.
Listing 2-33. Rule-Based Navigation Example 5
As shown in the previous listing, it is very simple to change a navigation case behavior from the HTTP Request
forward to the HTTP Redirect. Using the <redirect/> element inside the <navigation-case> , the HTTP Redirect will
be applied on this navigation case when it is matched.
The last feature that we want to cover in the JSF navigation is the conditional navigation feature, which is useful in
handling complex navigation cases. In order to understand this feature, let's see a detailed example. In this example,
the user enters an average number of (his/her) sleeping hours daily in order to know if (his/her) sleeping hours are:
Lower than the average (<7 hours).
Normal (from 7 to 9 hours).
Above the average (> 9 hours).
Figure 2-4 shows the example flow. The flow consists of four pages:
input.xhtml represents the starting input page. In this page, the user inputs (his/her) number
of sleeping hours and then clicks the "Check my sleeping hours" button to proceed to the
normal.xhtml represents the page that will be displayed if the user enters a number from 7 to 9.
above.xhtml represents the page that will be displayed if the user enters a number more than 9.
below.xhtml represents the page that will be displayed if the user enters a number less than 7.
Search WWH ::