Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Launch the Faces Configuration Editor by double-clicking on faces-config.xml

  2. Select the Navigation Rule tab in the Configuration Editor. Under the Palette window select Page. This will select a PageFlow Page GUI object.




  3. 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.




  4. Similarly add the welcome.jsp page on the Navigation Rule window. See the figure below:




  5. Select Link from the Palette window and join the two pages as shown in the figure:




  6. 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




  7. 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.




  8. Now lets add a index.jsp under WEBCONTENT WebContent as follows:
    Code Block
    ActionScript
    ActionScript
    borderStylesolid
    titleindex.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>
    
    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.
    This completes the Application Development process. The next step is to deploy and test the application.

...