SunQuest
 
       Java
  Home arrow Java arrow Page 3 - Introduction to JavaServer Faces, Part...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Introduction to JavaServer Faces, Part 3
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 19
    2004-03-22

    Table of Contents:
  • Introduction to JavaServer Faces, Part 3
  • Wrtiting the JSP Files for the Page Navigation Example
  • Creating the Application Configuration File for the Page Navigation Example
  • Compiling and Running the Page Navigation Example
  • Introducing the JSF Application Programming Interface (API)
  • javax Packages
  • More javax Packages

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Introduction to JavaServer Faces, Part 3 - Creating the Application Configuration File for the Page Navigation Example


    (Page 3 of 7 )

    In JSF, page navigation is controlled using one or more navigation rules in the application configuration file. Each rule specifies a page of origin and one or more possible targets. A page is represented by its tree identifier, and each possible target is represented by a navigation case. You need to specify a navigation rule for each page from which the user can navigate to another page. You also need to register the SurveyBean in the application configuration file. The application configuration file is shown in Listing 10.

    Listing 10 The Application Configuration File for the Page Navigation Example


    <?xml version="1.0" ? >
    <!DOCTYPE faces-config PUBLIC
      
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
      
    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
     
    <
    faces-config>
     
    <managed-bean>
      
    <managed-bean-name>surveyBean</managed-bean-name>
      
    <managed-bean-class>ch02c.SurveyBean</managed-bean-class>
      
    <managed-bean-scope>session</managed-bean-scope>
     
    </managed-bean>
     
    <navigation-rule>
      
    <from-tree-id>/page1.jsp</from-tree-id>
      
    <navigation-case>
      
    <to-tree-id>/page2.jsp</to-tree-id>
     
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
     
    <from-tree-id>/page2.jsp</from-tree-id>
      
    <navigation-case>
       
    <to-tree-id>/page1.jsp</to-tree-id>
      
    </navigation-case>
     
    </navigation-rule>
    </faces-config>

    A navigation rule is defined by the navigation-rule element in the application configuration file. For this application, each navigation-rule element needs to contain the from-tree-id element and navigation-case subelements. The from-tree-id 5 3 subelement is the tree identifier of the page of origin. The navigation-case subelement represents a possible target. A navigation-rule element can have zero or several navigation-case subelements. Each navigation-case element specifies the target page for a particular outcome of the from-tree-id processing. For this application, the navigation-case element simply contains a to-tree-id subelement that specifies the destination page.

    To specify which page to navigate to from the page1.jsp page, you use the following navigation-rule element:


    <navigation-rule>
     
    <from-tree-id>/page1.jsp</from-tree-id>
     
    <navigation-case>
      
    <to-tree-id>/page2.jsp</to-tree-id>
     
    </navigation-case>
    </navigation-rule>

    To specify which page to navigate to from the page2.jsp page, you use the following navigation-rule element:


    <navigation-rule>
     
    <from-tree-id>/page2.jsp</from-tree-id>
     
    <navigation-case>
      
    <to-tree-id>/page1.jsp</to-tree-id>
     
    </navigation-case>
    </navigation-rule>

     

    Buy this book now!Remember: This is part three of the second chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). If you've enjoyed what you've seen here, click on the "Buy it now!" banner to pick up a copy today!
    Buy this book!

    More Java Articles
    More By McGraw-Hill/Osborne


     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup

    BlackBerry VTS




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway