Java
  Home arrow Java arrow Page 6 - 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 1
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 52
    2004-03-08

    Table of Contents:
  • Introduction to JavaServer Faces, Part 1
  • Understanding the Request Processing Lifecycle Phases
  • Using an Application Configuration File
  • Writing a JSF Application
  • Writing JavaBeans and Event Listeners
  • Creating the Event Listener and Component Tree Example
  • Creating the Directory Structure
  • Writing the Object Model for the Listener and Component Tree Example
  • Defining Taglib Directives

  • 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 1 - Creating the Event Listener and Component Tree Example


    (Page 6 of 9 )

    The example presented in this section illustrates the process of developing a simple JSF application. It demonstrates how to write a JSF application with an event listener that is executed when the user clicks a button. The event listener simply prints the names of the components in the component tree.

    The application consists of a JSP page that has a form with two input fields to accept two numbers and print the result of the addition of the two numbers. There is also a button that, when clicked, fires an ActionEvent and causes an event listener to be executed.

    The page has five user interface (UI) components: a UIForm component, two UIInput components, a UIOutput component, and a UICommand component (these are described in the previous section). The UIInput components and the UIOutput component are bound to a JavaBean that stores the two input values and contains the logic of the addition.

    As explained earlier in this chapter, the request processing lifecycle always begins with the Reconstitute Component Tree phase. In this phase, the Lifecycle object builds the component tree representing the requested page. This example shows how a component tree looks conceptually. To be able to draw the tree, you need to create an event listener that will be called during one of the process event steps in the request processing lifecycle.

    The application consists of the following:

    • A JSP page named adder.jsp
    • A NumberBean JavaBean for storing user data
    • An action listener called MyActionListener
    • A deployment descriptor (web.xml)
    • An application configuration file for registering the JavaBean

    For your JSF application to work, it needs a set of .jar files containing the JSF reference implementation and other libraries. See the “Introduction” of this book for the list of all libraries you need to include in your JSF application.

    NOTE Don’t worry if you don’t fully understand the code used in the application examples in this chapter. The code will be explained in later chapters.

    Buy this book now!Remember: This is part one of the second chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). Stay tuned for part 2 of "Introduction to JavaServer Faces," where we learn about JSP, JavaBeans, and Model 2. 
    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 6 hosted by Hostway