SunQuest
 
       Java
  Home arrow Java arrow Page 2 - 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 
 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 - Wrtiting the JSP Files for the Page Navigation Example


    (Page 2 of 7 )

    This application has two JSP pages (page1.jsp and page2.jsp) as the user interface. The page1.jsp page is shown in Listing 8, and the page2.jsp page is shown in Listing 9.

    Listing 8 The page1.jsp File


    <f:use_faces><?xml:namespace prefix /><h:form formName="surveyForm"><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
    <head>
    <title>Online Survey</title>
    </head>
    <body>
    <h2>Online Survey</h2>
    <f:use_faces>
    <h:form formName="surveyForm" >
      
    <br/>Favorite Singer:
      
    <h:input_text id="favSinger" valueRef="surveyBean.favSinger"/>
      
    <br/>Favorite Band:
      
    <h:input_text id="favBand" valueRef="surveyBean.favBand"/>
      
    <br/>
      
    <h:command_button id="submit" label="Submit"
      commandName
    ="submit" />
    </h:form>
    </f:use_faces>
    </body>
    </html>



    Listing 9 The page2.jsp File


    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
    <head>
    <title>Thank You</title>
    </head>
    <body>
    <h2>Thank you for your feedback.</h2>
    <f:use_faces>
    <h:form formName="thankYouForm" >
    Your favorite singer is
    <h:output_text id="favSinger" valueRef="surveyBean.favSinger"/>
    and your favorite band is
    <h:output_text id="favBand" valueRef="surveyBean.favBand"/>
    <br/>Nowclick the button to go back to the previous page.
    <br/>
    <h:command_button id="goBack" label="Go Back"
    commandName
    ="goBack" />
    </h:form>
    </f:use_faces>
    </body>
    </html>

    In both pages, you use the same UI components you used in the previous examples. In the page1.jsp file, you use a form containing two UIInput components for the user’s favorite singer and favorite band. Both UIInput components are bound to the SurveyBean‘s properties.

    In the page2.jsp page, you use two UIOutput components to display the values entered by the user. The UIOutput components are also bound to the SurveyBean‘s properties, from which the components get their values. <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

    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





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