...
- Launch the Faces Configuration Editor by double-clicking on faces-config.xml
- Select the Navigation Rule tab in the Configuration Editor. Under the Palette window select Page. This will select a PageFlow Page GUI object.
- Drag the mouse over the Navigation Rule Window and click on the window. This will give a Select JSP File window. Select the login.jsp as shown in the figure and select OK.
- Similarly add the welcome.jsp page on the Navigation Rule window. See the figure below:
- Select Link from the Palette window and join the two pages as shown in the figure:
- Select the link between the two pages and go to properties view and set the value for From Outcome field as validated. This is because of the tag <h:commandButton id="submit" action="validated" value="Enter" />. Once all the inputs are valid the action taken is validated. See the figure
- Once done have a look the Source tab in the Faces Navigation Editor. A <navigation-rule> tag has been introduced into the faces-config.xml. This rule instructs the Controller that if all the inputs are valid from a form in the /pages/login.jsp, and the action is validated, then go to page /pages/welcome.jsp.
- Now lets add a index.jsp under WEBCONTENT WebContent as follows:
What is the login.jsf in the forward path tag ?? If you look at the web.xml *.jsf is used as the URL pattern to suggest that forwarded page be taken care by Java Server Faces Servlet.Code Block ActionScript ActionScript borderStyle solid title index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%> <\!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body> <jsp:forward page="/pages/login.jsf" /> </body> </html>
This completes the Application Development process. The next step is to deploy and test the application.
...