O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

JSF 1.2 Components

Book Description

Develop advanced Ajax-enabled JSF applications

  • Develop advanced Ajax-enabled JSF applications and solve common web development challenges using UI components from JSF component libraries

  • Master the basics of building web user interfaces with standard JSF HTML components

  • Implement UI security using JAAS and Apache Tomahawk components

  • Master a wide range of UI components and learn cutting-edge JSF development strategies with plenty of examples and screenshots

In Detail

Today's web developers need powerful tools to deliver richer, faster, and smoother web experiences. JavaServer Faces includes powerful, feature-rich, Ajax-enabled UI components that provide all the functionality needed to build web applications in a Web 2.0 world. It's the perfect way to build rich, interactive, and "Web 2.0-style" Java web apps.

This book provides a comprehensive introduction to the most popular JSF components available today and demonstrate step-by-step how to build increasingly sophisticated JSF user interfaces with standard JSF, Facelets, Apache Tomahawk/Trinidad, ICEfaces, JBoss Seam, JBoss RichFaces/Ajax4jsf, and JSF 2.0 components. JSF 1.2 Components is both an excellent starting point for new JSF developers, and a great reference and “how to” guide for experienced JSF professionals.

This book progresses logically from an introduction to standard JSF HTML, and JSF Core components to advanced JSF UI development. As you move through the book, you will learn how to build composite views using Facelets tags, implement common web development tasks using Tomahawk components, and add Ajax capabilities to your JSF user interface with ICEfaces components. You will also learn how to solve the complex web application development challenges with the JBoss Seam framework. At the end of the book, you will be introduced to the new and up-coming JSF component libraries that will provide a road map of the future JSF technologies.

Table of Contents

  1. JSF 1.2 Components
    1. JSF 1.2 Components
    2. Credits
    3. Foreword
    4. About the Author
    5. About the Reviewers
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Conventions
      4. Customer support
        1. Downloading the example code for the book
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Standard JSF Components
      1. An introduction to JSF
        1. The Model-View-Controller architecture
        2. Managed beans
        3. The JSF Expression Language (JSF EL)
        4. Converters and validators
      2. Next steps
      3. Getting input from the user
        1. Rendering a text field
        2. Rendering a text area
      4. Form submission
        1. Rendering a form
        2. Rendering a button
        3. Rendering a link
      5. Rendering text
        1. Rendering localized text
          1. Registering a message bundle (JSF 1.1)
          2. Registering a message bundle (JSF 1.2)
        2. Rendering date/time information
        3. Rendering parameterized text
        4. Rendering labels
        5. Rendering a validation message
        6. Rendering all validation messages
      6. Making selections
        1. Rendering a checkbox
        2. Rendering multiple checkboxes
        3. Rendering radio buttons
        4. Selecting one or selecting many values
        5. Rendering a list of countries
        6. Rendering a single-select list of options
        7. Rendering a multiple-select list of options
      7. Laying out components
        1. Rendering a complex layout table
        2. Rendering a table column
      8. Displaying data
        1. Rendering an HTML table
      9. Summary
    8. 2. Facelets Components
      1. A brief history of Java web development
      2. Comparing Facelets and JSP
      3. Configuring a JSF application to use Facelets
        1. Configuring web.xml
        2. Configuring faces-config.xml
      4. Getting started with Facelets
        1. Hello World Facelets
      5. Rendering debug information
      6. Iterating data in a Facelets page
      7. Removing UI components and markup
      8. Including UI components and markup
        1. Including a header and footer
          1. Creating the header Facelet
          2. Creating the footer Facelet
      9. Passing parameters from one Facelet to another
      10. Rendering a UI composition
        1. Including a UI composition
        2. Declaring a UI composition
      11. Rendering a UI component
        1. Including a UI component
        2. Declaring a UI component
      12. Creating a Facelets UI composition template
        1. A simple Facelets template
          1. A simple Facelets template client
          2. Another simple Facelets template client
        2. A more complex Facelets template
      13. Decorating the user interface
        1. Decorating content on a Facelets page
        2. Creating a Facelets decoration
      14. Rendering a UI fragment
      15. An advanced Facelets composition template
      16. Summary
    9. 3. Apache MyFaces Tomahawk Components
      1. Validating user input
        1. Validating e-mail addresses
        2. Validating a phone number with a regular expression pattern
        3. Validating that two fields have an equal value
      2. Managing date and time selection
        1. Selecting a date
        2. Rendering a simple calendar
        3. Rendering an appointment schedule
      3. File management
        1. Uploading a file
      4. Working with trees
        1. Creating a tree
        2. Creating a tree column
        3. Customizing the tree component
      5. Navigation menus
        1. Creating a navigation menu
        2. Creating bookmarkable navigation menus
        3. Populating a navigation menu
        4. Generating dynamic navigation menus
        5. Using the JSCookMenu component
      6. User interface security
        1. Configuring web.xml
        2. Security-enabled components
        3. Tomahawk SecurityContext EL extension
      7. Displaying data
        1. Rendering an unordered list
        2. Rendering a definition list
        3. Rendering a data table
          1. Paginating a data table
          2. Rendering a multi-column data table with a newspaper layout
      8. Summary
    10. 4. Apache MyFaces Trinidad Components
      1. Installation and Configuration
      2. What is Ajax?
      3. Receiving input from the user
        1. Rendering a color picker
        2. Rendering a calendar
        3. Rendering a number spinbox
        4. Rendering a text field
        5. Rendering a selectable list of values
      4. Client-side conversion and validation
        1. Enabling client-side validation in trinidad-config.xml
        2. Validating one field at a time
      5. Enabling Ajax functionality
        1. Partial submit and partial triggers
        2. Polling the server
        3. Rendering a status indicator
        4. Rendering a progress bar
      6. Laying out components on the screen
        1. Rendering a row layout
        2. Rendering a complex table layout
        3. Rendering a form layout
        4. Rendering a panel group layout
      7. Shuttling selections between lists
        1. Rendering a multiple selection shuttle
        2. Rendering an ordered shuttle
      8. Working with tree and tree table components
        1. Rendering a tree
        2. Rendering a tree table
      9. Creating navigation menus
        1. Rendering a navigation tree
        2. Rendering breadcrumbs
        3. Rendering a multistep process (Train)
        4. Rendering a process choice bar
      10. Skinning and theme selection
        1. Creating a new Trinidad skin
        2. Implementing the skin's cascading style sheet
        3. Rendering an icon
        4. Customizing the Trinidad tree component's node icons
      11. Implementing dialog windows
        1. Declaring dialog navigation rules in faces-config.xml
        2. Launching a dialog window
        3. Returning a value from a dialog window
      12. Summary
    11. 5. ICEfaces Components
      1. Receiving input from users
        1. Rendering validation messages and text with effects
        2. Receiving HTML input from users
        3. Handling file uploads with ICEfaces
        4. Rendering a calendar component
      2. Creating navigation and pop-up menus
        1. Creating a horizontal navigation menu with submenus
        2. Rendering a vertical navigation menu with submenus
        3. Adding menu separator items
        4. Using context menus
      3. Using tree components
        1. Using the default tree node icons
        2. Using custom tree node icons
      4. Displaying data in tables
        1. The ICEfaces data table component
        2. Rendering dynamic columns
        3. Implementing sortable column headers
        4. Supporting resizable columns
        5. Data table single row selection mode
        6. Data table multiple row selection mode
        7. Data table enhanced multiple row selection mode
        8. Implementing data set paging
      5. Rendering charts
        1. Rendering a stacked bar chart
        2. Rendering a 3-D pie chart
        3. Rendering a bar chart
      6. Laying out components with panels
        1. Working with a border layout
        2. Rearranging elements in a list
        3. Rendering a series of components
        4. Rendering collapsible panels
      7. Creating a tabbed user interface
      8. Working with modal dialogs
        1. Rendering a simple modal dialog
        2. Rendering a draggable dialog box
          1. Rendering a draggable modal dialog
      9. Summary
    12. 6. JBoss Seam Components
      1. Introducing the JBoss Seam framework
      2. Java Enterprise Edition (Java EE) technology
        1. Understanding Java SE and Java EE
          1. Introducing Enterprise JavaBeans (EJB3) technology
            1. Introducing the Java Persistence API (JPA)
            2. Container Managed Transactions (CMT)
            3. Activation and passivation for Stateful Session Beans (SFSBs)
            4. Object pooling for Stateless Session Beans (SLSBs)
            5. Integrating EJB3 and JSF with Seam
          2. Introducing Seam components
        2. Introducing REST
      3. Next steps
      4. Validating user input with the Seam framework
      5. Implementing JSF validation with Seam
        1. JPA and the Hibernate Validator framework
      6. Decorating the UI to improve form validation
      7. Adding cutting-edge Ajax technology with Ajax4jsf
      8. Displaying success messages in JSF
      9. Seam conversation management
        1. Temporary conversations
          1. ShippingCalculatorBean.java
          2. faces-config.xml
          3. pages.xml
          4. conversation01.jsf
          5. conversation02.jsf
        2. Starting a long-running conversation
          1. Declaring navigation rules in faces-config.xml
          2. Defining a long-running conversation in pages.xml
          3. Implementing OrderBeanImpl.java
          4. The introductory page of the order process
          5. The customer registration screen (Step 1)
          6. The shipping information screen (Step 2)
          7. The order details confirmation screen (Step 3)
        3. Concurrent conversations
      10. Debugging Seam applications
      11. Summary
    13. 7. JBoss RichFaces and Ajax4jsf Components
      1. Introducing JBoss RichFaces and Ajax4jsf
        1. The JBoss RichFaces component library
        2. The Ajax4jsf component library
      2. Accepting user input
        1. Rendering editable text
        2. Rendering an in-place select component
        3. Combining in-place input and select components
        4. Rendering a slider component
        5. Rendering a number spinner component
        6. Rendering a calendar component
        7. Rendering a color picker component
        8. Rendering a combo box component
        9. Rendering a suggestion box component with auto-complete
        10. Rendering a pick list component
        11. Rendering a rich text editor component
      3. Using Ajax effectively
        1. Understanding how Ajax4jsf works
        2. Ajax-enabled form submission
        3. Invoking an Ajax-enabled command link
        4. Polling the server asynchronously
      4. Panel components
        1. Creating a basic panel
        2. Rendering a panel bar
        3. Rendering a panel menu
        4. Rendering groups of menu items
        5. Rendering a tabbed user interface
        6. Rendering a toggle panel
      5. Displaying data
        1. Rendering a data table
        2. Rendering a data table with a header, footer, and caption
        3. Implementing sortable data table column headers
        4. Filtering rows in a data table
        5. Rendering a data grid
        6. Adding a data scroller
        7. Customizing the data scroller
        8. Rendering an ordered list
        9. Customizing an ordered list
        10. Rendering a data definition list
      6. Using special components
        1. Rendering a Google Maps object
        2. Rendering a Microsoft Virtual Earth object
      7. Summary
    14. A. Learning JSF: Next Steps
      1. JSF 2.0
        1. New JSF annotations added to ease configuration
        2. Simplified navigation mapping convention
          1. JSF 1.x Navigation Mapping
          2. JSF 2.0 Navigation Mapping
        3. A Web resource loading mechanism for images, stylesheets, JavaScript files, and so on
        4. Facelets is now integrated in JSF 2.0
        5. The new "composite" JSF tag library for creating composite components
        6. Built-in support for adding Ajax capabilities to UI components with <f:ajax>
      2. The PrimeFaces component library
      3. Next steps