4. Define Page Navigation Rules

You have noticed the warning error The Navigation outcome "success" returned from the "registerUser" action method is not valid from this page.

It shows the warning because we have not defined navigation rules for the register.jsp page. On successful registration the user will be navigated to the home.jsp page.

4.1. Define Navigation rule

  1. Switch to the Project Explorer view.
  2. Copy the home.jsp.txt file from the folder workshop-jsf-tutorial/web/Resources to the pages folder.
  3. Rename it as: home.jsp. (Right-click the file and select Refactor > Rename.) Also add key-value pairs from the file workshop-jsf-tutorial/web/Typing_Aid/application_properties_2.txt to the application.properties file. The home.jsp page uses these key-value pairs to show localized text.
  4. Open the faces-config.xml file in the WEB-INF/config folder.
  5. Right-click Navigation Rules under the Faces Config Tags list. In pop-up menu select New Navigation Rule.
  6. In the Navigation Rule Tag dialog click the icon next to the Source Page field and choose the file register.jsp.
  7. Click OK.


  8. This will add navigation rule for register.jsp as source page.

4.2. Add Navigation Case for Navigation Rule

  1. Right-click the navigation rule pages/register.jsp and select New Navigation Case.

  2. In the Outcome field type success.
  3. Click the icon next to the Destination Page field and choose the file home.jsp.
  4. Save the faces-config.xml file.
  5. Note that from the Problems view the warning message disappeared as the outcome success matches with the logical outcome returned by the action of the submit button in register.jsp page.

4.3. Editor view of faces-config.xml

Workshop offers a synchronized 2-way split-pane editor view for the JSF configurations file faces-config.xml.

4.4. Visualize faces-config.xml using the Navigation view

The faces-config.xml file can be visualized in a Navigation view. Upon selection or editing, the Navigation view is synchronized with the source in real-time. There is no need to tab between views. With the Workshop 2-way, split-pane view, you can see (and edit) them both at the same time!

Click one of the following arrows to navigate through the tutorial:


Still need help? Post a question on the Workshop newsgroup.