Java
  Home arrow Java arrow Page 7 - 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 Directory Structure


    (Page 7 of 9 )

    As the first step, you need to create a directory structure for your JSF application. In Tomcat, you create this under webapps. The directory structure for your application, called JSFCh02a, is depicted in Figure 4. The directory contains all the required components that you will build in this example.

    First, note that you must copy the .jar files containing the JSF implementation into the WEB-INF/lib directory. Then, in the WEB-INF/classes directory, you have the JavaBean class. In the WEB-INF directory, you have the deployment descriptor (web.xml) and the application configuration file (faces-config.xml). Lastly, the adder.jsp page is in the application directory itself.

    Writing the Deployment Descriptor for the Listener and Component Tree Example

    Just like any other servlet/JSP application, this JSF application needs a deployment descriptor. Listing 1 presents the deployment descriptor for this application.

    JSF structure

    Figure 4 The directory structure of the listener and
    component tree example

    Listing 1 The Deployment Descriptor (web.xml)


    <?xml version="1.0"? >
    <!DOCTYPE web-app PUBLIC
      
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      
    "http://java.sun.com/dtd/web-app_2_3.dtd">

    <P align=left
    <
    P align=left><web-app>
      
    <!-- Faces Servlet -->
      
    <servlet>
        
    <servlet-name>Faces Servlet</servlet-name>
        
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        
    <load-on-startup</load-on-startup>
      
    </servlet>

    <P align=left
    <
    P align=left>  <!-- Faces Servlet Mapping -->
      
    <servlet-mapping>
        
    <servlet-name>Faces Servlet</servlet-name>
        
    <url-pattern>/faces

    There are two sections in the deployment descriptor. The servlet element registers the FacesServlet, and the servlet-mapping element states that any request containing the pattern /faces/ in the URL must be passed to the FacesServlet

    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

    BlackBerry VTS




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