By: Jagan in JSF Tutorials on 2007-09-18
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.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in JSF )
Latest Articles (in JSF)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews