Facelets

Book description

Curious about Facelets, but short on time for trying a new product? This short cut shows you how to start developing web pages quickly with Facelets, the new JavaServer Faces-based templating framework.

This short cut begins with an explanation of what Facelets is, how it works, and what it will do for you. Then, it shows you how to install Facelets, and teaches you how to build Facelets templates, how to create UI components without writing a single line of Java code, how to create custom Facelets tags, how to integrate AJAX into a Facelets application, and more.

Facelets unleashes the power and versatility of Faces by replacing the default JSP view handler with an xhtml template compiler. This short cut shows how Facelets lessens development time and improves code reusability. Are you ready to build a top-notch JSF user interface with Facelets? Power up your computer and let's go.

Table of contents

  1. Facelets
    1. A Note Regarding Supplemental Files
    2. Preface
    3. Chapter 1. Introducing Facelets: A Better JSF ViewHandler
      1. 1.1 What Is Facelets?
      2. 1.2 JavaServer Faces Integration
        1. 1.2.1 The FaceletViewHandler
        2. 1.2.2 The FaceletViewHandler in the JSF lifecycle
        3. 1.2.3 The ViewHandler pluggable interface
        4. 1.2.4 Decorating the default ViewHandler
      3. 1.3 How Facelets Works
        1. 1.3.1 The Facelets API
        2. 1.3.2 The Facelets API in action
          1. buildView method
          2. Facelet document compiler
      4. 1.4 Why Facelets?
        1. 1.4.1 Reusability
        2. 1.4.2 JSF Integration
        3. 1.4.3 JSP/JSF discordance
    4. Chapter 2. Setting Up the Facelets Development Environment
      1. 2.1 About the Facelets Development Environment
      2. 2.2 Development Software
        1. 2.2.1 Prerequisite software
        2. 2.2.2 Eclipse IDE
        3. 2.2.3 MySQL database
      3. 2.3 Download and Install the Prerequisite Software
        1. 2.3.1 Download and install JDK version 5
        2. 2.3.2 Download and install JBoss 4.0.4
        3. 2.3.3 Download and install JavaServer Faces 1.2
      4. 2.4 Download and Install IDE
        1. 2.4.1 Eclipse IDE
        2. 2.4.2 JBoss Eclipse IDE
      5. 2.5 Download and Configure Facelets
        1. 2.5.1 Download the Facelets distribution
        2. 2.5.2 Configure a web project
        3. 2.5.3 Copy the Facelets and JSF libraries to the web project
        4. 2.5.4. Configure the application web descriptor (web.xml).
        5. 2.5.5 Set up the JavaServer Faces configuration file (faces-config.xml)
        6. 2.5.6 Add the JSF and Facelets libraries to the deployment
      6. 2.6 Download, Install, and Configure Database Software
        1. 2.6.1 Download MySQL database and GUI tools
      7. 2.7 Configure JBoss MySQL DataSource
      8. 2.8 Start Server to Check Deployment
      9. 2.9 Importing the GoodEats! Project into Eclipse
        1. 2.9.1 Downloading the GoodEats! Project
        2. 2.9.2 Importing the GoodEats! project
    5. Chapter 3. Developing JSF Views with Facelets
      1. 3.1 Building the Good Eats! Homepage with Facelets
      2. 3.2 The Facelets View File
      3. 3.3 The Prototype Home Page
      4. 3.4 Compositions
      5. 3.5 Facelets Expression Language—the Glue
      6. 3.6 JSF Backing Bean
      7. 3.7 Styling Facelets Views with CSS
    6. Chapter 4. Developing and Using Facelets Templates
      1. 4.1 What Are Templates?
        1. 4.1.1 Templating roles: template and template client
        2. 4.1.2 Templating tags
      2. 4.2 Developing a Templating Strategy
        1. 4.2.1 Refactoring the GoodEats! Home page
        2. 4.2.2 Create the template
        3. 4.2.3 Creating the template client
      3. 4.3 Advanced Templating
        1. 4.3.1 The ui:decorate tag
        2. 4.3.2 Using the ui:decorate tag
    7. Chapter 5. Developing and Using Facelets Component Tags
      1. 5.1 The Facelets Component Tags
        1. 5.1.1 The component tags: ui:component and ui:fragment
      2. 5.2 Using the Component Tags
        1. 5.2.1 Using the ui:component tag
        2. 5.2.2 Using the ui:fragment tag
      3. 5.3 Right Sidebar Component.
    8. Chapter 6. Developing and Using Composition Components
      1. 6.1 What Are Composition Components?
      2. 6.2 Creating a Composition Component
        1. 6.2.1 Create the component
        2. 6.2.2 Create the Facelets taglib
        3. 6.2.3 Declare the taglib in the web.xml file
        4. 6.2.4 Declare the XML namespace and use the custom tag
      3. 6.3 Example: A List Layout Composition Component
        1. 6.3.1 Step 1: Build the composition component and backing bean
        2. 6.3.2 Step 2: Develop the Facelets custom taglib
        3. 6.3.3 Step 3: Declare the taglib in the web.xml file
        4. 6.3.4 Step 4: Declare the XML namespace and use the custom tag
    9. Chapter 7. Extending and Customizing Facelets
      1. 7.1 Extensibility: JSF and Facelets
      2. 7.2 Extending Facelets with Custom Tags
        1. 7.2.1 What is a custom tag?
        2. 7.2.2 The Facelets taglib
        3. 7.2.3 Developing a custom tag
      3. 7.3 Custom Tag Example: Joda DateTime Converter
        1. 7.3.1 Develop the Converter class
        2. 7.3.2 Add the Converter tag to the tag library
        3. 7.3.3 Register the Converter with JSF
        4. 7.3.4 Using the Joda DateTime Converter
      4. 7.4 Extending Facelets with Custom TagHandlers
        1. 7.4.1 What is a TagHandler?
        2. 7.4.2 Developing a custom TagHandler
      5. 7.5 Custom TagHandler Example: The execute TagHandler
        1. 7.5.1 The handler-class
      6. 7.6 Extending Facelets with EL Functions
        1. 7.6.1 What is an EL function?
        2. 7.6.2 Developing an EL function
        3. 7.7 EL Function Example: formatName Function
    10. Chapter 8. Enriching the User Interface Experience with AJAX
      1. 8.1 Facelets and JavaScript
        1. 8.1.1 Enclose JavaScript in CDATA
        2. 8.1.2 Import JavaScript from an external file
        3. 8.1.3 JavaScript in attributes values
        4. 8.1.3 JavaScript attributes bound to a bean method
      2. 8.2 Facelets, JSF, and AJAX
        1. 8.2.1 What is AJAX?
        2. 8.2.2 JSF/Ajax integration issues
        3. 8.2.3 The panoply of AJAX frameworks
        4. 8.2.4 AJAX for the JavaScript avoidant
      3. 8.3 Example: Ajax-enabled selection boxes
        1. 8.3.1 ajax4jsf configuration
        2. 8.3.2 Developing interrelated selection boxes with AJAX
        3. 8.3.3 Developing a suggest selection box with AJAX
    11. Chapter 9. The Good Eats! Web Site
      1. 9.1 What Is the Good Eats! Web Site?
      2. 9.2 Requirements
        1. 9.2.1 Business requirements
        2. 9.2.2 Technical requirements
      3. 9.3 Web Site Construction
        1. 9.3.1 User interface: Facelets
          1. Layout
          2. CSS Rules
          3. JavaScript
          4. Facelets Components
          5. Template Client View
          6. Faces Backing Beans
        2. 9.3.2 Domain layer: Enterprise JavaBeans
          1. Domain Layer Components
        3. Stateless Session Beans
        4. Entity Beans
        5. 9.3.3 Database: MySQL
          1. Site Administration Tables
          2. Site Content Tables
    12. About the Author

Product information

  • Title: Facelets
  • Author(s):
  • Release date: March 2007
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596529246