Controlling Page Navigation in JSF - Static and Dynamic Navigation

By: Jagan Emailed: 1647 times Printed: 2115 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Page navigation in your JSF application is handled by providing navigation rules in a configuration file. The navigation can specify which web component initiates the request, which web component handles the response, and which value causes navigation to follow the flow. So far, you have seen only navigation based on the hard-coded string value of an action attribute. You can also control navigation by using value-binding expressions and method-binding expressions. Navigation then depends on the value of the expression.

Static and Dynamic Navigation

When you control navigation through string values of the action attribute, the path of navigation is known when the application is deployed. We call this static navigation, because the flow is statically determined and does not change. It is the same for every request. When using static navigation, you explicitly code a value into the action attribute of a JSF custom tag. You then define navigation rules in a configuration file. The rule specifies navigation flow when the <from-outcome> of a page matches the value of the action attribute. When that occurs, navigation flows to the specified <to-view-id>. These elements are part of a navigation rule element in a configuration file, such as faces-config.xml.

When you control navigation through value-binding expressions or method-binding expressions, the path of navigation is not known when the application is deployed. In fact, navigation flow can vary from request to request depending on the value of the expression. We call this dynamic navigation.

For dynamic navigation, you use a value-binding expression or method-binding expression as the value of the action attribute. With value-binding expressions, the value of the property must be of type String. With method-binding expressions, the method must take no parameters and return a value of type String: 

public String search();

The String value returned by the method is compared to the value specified in the navigation rule to determine where control flow should go.


JSF Home | All JSF Tutorials | Latest JSF Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(1)


1. View Comment

Controlling Page Navigation in JSF - Static and Dynamic Navigation thanks.

View Tutorial          By: chip at 2010-10-07 05:16:14

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Jagan
Importing a Certificate for the CA example using keytool in Java
The if-then-else Statement in Java
WHERE Clauses in SQL
The TryCatchFinally Interface in JSP
assert() Function Example program in C
Guidelines for Struts Application Development
Using printf function in C
File Inclusion in C
Using Multiple Message Resource Bundles in Struts
While and For Loops in C
Arrays sample program in C
Controlling Page Navigation in JSF - Static and Dynamic Navigation
Using cout.fill() in C++
Types of Profiles in J2ME
DateField sample program in J2ME

More Tutorials in JSF
Struts Vs JSF (A comparison of Struts against JSF)
faces-config.xml to DirectTraffic in the JSF Application
<convertNumber> and <convertDateTime> in JSF
Action listeners in JSF
Calling Multiple Listeners in JSF
Using Javascript in JSF
How to open a new browser window from my JSF page?
Servlet error : java.lang.IndexOutOfBoundsException (JSF RI 1.1_01: IndexOutOfBoundsException)
JSF - TreeNode.setID gets IllegalArgument Exception
Install and Deploy JBoss Application Server
What is JSF (JavaServer Faces)?
Differences between JavaServer Faces technology and Struts
JSF Basics
The Relationship Between JSF and Other Java EE Technologies
JSF Life Cycle

More Latest News
Most Viewed Articles (in JSF )
How to open a new browser window from my JSF page?
Using Javascript in JSF
Java Bean Scopes in JSF
Calling Multiple Listeners in JSF
Accessing Context Data in Beans using JSF
<convertNumber> and <convertDateTime> in JSF
What is JSF (JavaServer Faces)?
JSF Life Cycle
Controlling Page Navigation in JSF - Static and Dynamic Navigation
JSF - TreeNode.setID gets IllegalArgument Exception
faces-config.xml to DirectTraffic in the JSF Application
Action listeners in JSF
Struts Vs JSF (A comparison of Struts against JSF)
Install and Deploy JBoss Application Server
Differences between JavaServer Faces technology and Struts
Most Emailed Articles (in JSF)
Controlling Page Navigation in JSF - Static and Dynamic Navigation
Using Javascript in JSF
Calling Multiple Listeners in JSF
JSF Life Cycle
Accessing Context Data in Beans using JSF
JSF Basics
Installing JSF
How to open a new browser window from my JSF page?
JSF - TreeNode.setID gets IllegalArgument Exception
Install and Deploy JBoss Application Server
Java Bean Scopes in JSF
Servlet error : java.lang.IndexOutOfBoundsException (JSF RI 1.1_01: IndexOutOfBoundsException)
faces-config.xml to DirectTraffic in the JSF Application
Action listeners in JSF
Struts Vs JSF (A comparison of Struts against JSF)