Java Reference
In-Depth Information
Each
navigation-rule
element corresponds to one component tree identifier defined
by the optional
from-view-id
element. This means that each rule defines all the pos-
sible ways to navigate from one particular page in the application. If there is no
from-
view-id
element, the navigation rules defined in the
navigation-rule
element ap-
ply to all the pages in the application. The
from-view-id
element also allows wildcard
matching patterns. For example, this
from-view-id
element says that the navigation
rule applies to all the pages in the
books
directory:
<from-view-id>/books/*</from-view-id>
A
navigation-rule
element can contain zero or more
navigation-case
ele-
ments. The
navigation-case
element defines a set of matching criteria. When these
criteria are satisfied, the application will navigate to the page defined by the
to-view-
id
element contained in the same
navigation-case
element.
The navigation criteria are defined by optional
from-outcome
and
from-action
elements. The
from-outcome
element defines a logical outcome, such as
success
.
The
from-action
element uses a method expression to refer to an action method that
returns a
String
, which is the logical outcome. The method performs some logic to de-
termine the outcome and returns the outcome.
The
navigation-case
elements are checked against the outcome and the method ex-
pression in this order:
1.
Cases specifying both a
from-outcome
value and a
from-action
value.
Both of these elements can be used if the action method returns different outcomes
depending on the result of the processing it performs.
2.
Cases specifying only a
from-outcome
value. The
from-outcome
element
must match either the outcome defined by the
action
attribute of the
javax.faces.component.UICommand
component or the outcome returned
by the method referred to by the
UICommand
component.
3.
Cases specifying only a
from-action
value. This value must match the
ac-
tion
expression specified by the component tag.
When any of these cases is matched, the component tree defined by the
to-view-id
element will be selected for rendering.
To Configure a Navigation Rule
Using NetBeans IDE, you can configure a navigation rule by doing the following.