Java
  Home arrow Java arrow Page 2 - Introduction to JavaServer Faces, Part 3
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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: starstarstarstarstar / 20
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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

    - Exception Handling Techniques in Java
    - More About Multithreading in Java
    - The Basics of Multiple Threads in Java
    - Data Access Using Spring Framework JDBC
    - New Object Initialization in Java
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT