You are previewing Apache MyFaces Trinidad 1.2.
O'Reilly logo
Apache MyFaces Trinidad 1.2

Book Description

Develop JSF web applications with Trinidad and Seam

  • Develop rich client web applications using the most powerful integration of modern web technologies

  • Covers working with Seam security, internationalization using Seam, and more

  • Get well-versed in developing key areas of web applications

  • A step-by-step approach that will help you strengthen your understanding of all the major concepts

In Detail

In today's world, JSF is one of the pivotal technologies for implementing middle- to large-scale web applications. With Trinidad, JSF developers have a powerful open source component framework at their fingertips.

This book introduces Apache MyFaces Trinidad, a powerful JSF component framework and combines it with Seam, the next-generation Web Application Framework to achieve the most comprehensive and effective technology for the development of powerful rich-client web applications.

In this book, you start out by learning where Trinidad comes from and what its aims are. You will learn how Facelets and Seam are used to get the most out of JSF. In addition, you will also learn the often occurring tag attributes, and, in particular, Trinidad's AJAX technology. You will implement login, authorization, navigation, internationalization, polling, and support for browser issues with the help of these technologies. You will then use Seam-gen for deployment.

Next, you will develop a web application example where a series of selected Trinidad components are applied and their capabilities explored. Finally, you will master the Trinidad dialog framework, a key Trinidad technology that allows the application of dialogs.

Table of Contents

  1. Apache MyFaces Trinidad 1.2
  2. Credits
  3. About the Author
  4. About the Reviewers
  5. Preface
    1. What this book covers
    2. Conventions
    3. Reader feedback
    4. Customer support
      1. Errata
      2. Piracy
      3. Questions
  6. 1. Introducing Trinidad
    1. Background
    2. Overview of Trinidad
      1. Characteristics of Trinidad
    3. General key criteria for the choosing of Trinidad
    4. Seamidad! Ease JSF development with Seam
      1. Introduction and overview of Seam
      2. Application of Seam with Trinidad
        1. Seam conversations and other context management
        2. Seam navigation
        3. Seam authorization
        4. Configuring Trinidad
          1. Important Trinidad configuration parameters in the web.xml
          2. Important Trinidad configuration parameters in the trinidad-config.xml
          3. Other configuration parameters
            1. Special parameters in the trinidad-config.xml
            2. Special parameters in the web.xml for further optimization
    5. Summary
  7. 2. Structuring and Building Pages with Facelets
    1. Facelet page composition—templating with Facelets
      1. Using the template
    2. Facelet composition components
      1. Creating the composition component
      2. The model attribute
      3. The visible attribute
      4. The msgLabel attribute
      5. The labelStyle attribute
      6. The required attribute
      7. The readOnly attribute
      8. The width attribute
      9. The margin attribute
      10. Declaring the composition component
      11. Applying the composition component
    3. Using JSTL for further refinement
      1. Typical JSTL structures
      2. Things to be aware of when using JSTL and Facelets
        1. Other tags to be aware of
        2. Experiencing Facelets in real life projects
    4. Summary
  8. 3. Most Wanted Tags and Tag Attributes
    1. Component library structure
      1. Trinidad’s XHTML tag library namespace (trh)
      2. Trinidad’s core tag library namespace (tr)
    2. Standard tag attributes
    3. Standard tag attributes in tag groups
      1. Attributes that occur in form and display tags
      2. Attributes that occur in command and navigation components
      3. Attributes that occur in large input and output components
        1. The tag attributes for table, treeTable, and tree
        2. The tag attributes for table and treeTable
        3. The tag attributes for tree and treeTable
        4. The tag attributes for treeTable
        5. The tag attributes for tree
    4. Summary
  9. 4. Rendering Pages Partially
    1. Tag-based PPR
      1. Finding the trigger
        1. Aspect 1: Ensure that the ID of the PPR trigger is correct
        2. Aspect 2: Ensure that the Trinidad configuration is correct
        3. Aspect 3: Ensure that the refreshed fields are reset
        4. Aspect 4: Ensure proper MVC setup
        5. Aspect 5: Ensure that the tag's partialTriggers work
        6. Aspect 6: Beware of using PPR with the rendered attribute
      2. PPR with server-side caching by means of the Trinidad pageFlowScope
      3. PPR with a tr:selectOneChoice to refresh itself inside a component
      4. PPR with a tr:selectOneChoice component and a valueChangeListener
      5. PPR with a tr:selectOneChoice component and an actionListener
      6. PPR and the rendered attribute
        1. Applying PPR naively
        2. The right way—a parent component with partial trigger
    2. Java-side PPR using Trinidad's RequestContext
      1. Application of PPR from the Java-side
        1. Step I: Define the PPR source
        2. Step II: Add the partial target
    3. Summary
  10. 5. Web Application Groundwork
    1. Navigation
    2. Trinidad's Dialog Framework
      1. Programmatically creating a dialog
      2. Providing the data flow from dialog to dialog
      3. Returning from a dialog
    3. Authorization
      1. Equipping each XHTML with authorization
      2. User authorization
    4. Internationalization (I18n)
      1. I18n on single labels
      2. I18n on internal Facelet composition components
    5. Polling
    6. Setting up the application with Seam-gen
      1. Setting up an Eclipse project using Seam-gen
    7. Deployment
      1. Trinidad-specific and Facelet-related changes to the project files
      2. Trinidad-specific changes to the Ant build script
        1. Deployment from Eclipse
      3. Browser client setup
      4. Summary
  11. 6. Building a Panel-based Content
    1. Where the Trinidad panel components live and what they support
    2. The accordion and showDetailItem components
      1. How to play the panelAccordion
      2. The showDetailItem component—press to play an accordion key
    3. The combination of Accordion and showDetailItem
      1. An alternative to pure Facelets
      2. The content panel—same soul, different incarnation
      3. ControllerPanel keeps the panels under the same roof
      4. The toolbar facet
    4. Skinning the panels
      1. Skinning the Accordion and its children
      2. Skinning specific properties of the Accordion's children
      3. Switching the skins on configuration level
    5. Summary
  12. 7. Building a Form
    1. Building a form
      1. Step I: Building the composition components
        1. The fieldText component
        2. The fieldDate component
        3. The fieldNumber component
        4. The fieldSelect component
      2. Step II: Building the form
        1. Building a form with several panelFormLayout instances
        2. The approach
      3. Step III: Decorating the form with Trinidad's form submission controls
        1. Processing of a part of a form by means of Trinidad subforms
      4. Step IV: Adding a general message area
    2. Summary
  13. 8. Growing a Tree
    1. Trinidad's tree components
    2. ChildPropertyTreeModel—Trinidad's out of the box model
    3. Creating a TreeNode Model
    4. Building up a tree model
      1. Extending the ChildPropertyTreeModel to a Seam component
      2. Preparing the panels for navigation
      3. Applying the navigation component for basic navigation control
    5. Creating the XHTML
      1. Using the nodeStamp facet to generate the tree
      2. Using a commandLink to create the clickable tree node
      3. Passing the node parameters to the navigation control
    6. Extending the model-view tree couple
      1. Preparations for the new tree model
        1. The properties of the AbstractTreeNode
        2. The AbstractTreeNode constructors
        3. New and modified helper methods
        4. The abstracted getters and setters
        5. The new TreeNode implementation is now short and easy
        6. The new tree node implementation for the new tree model
      2. The new tree model—based on Trinidad's abstract TreeModel
        1. Test out the row disclosure by adding a RowDisclosureEvent listener
        2. Another tree content to better try tree traversal
        3. The getters to access the new state
        4. Tree traversal with Trinidad's container methods
          1. The row key methods
          2. The row index methods
          3. The general row methods
          4. The table-related methods are implemented as empty methods
      3. The controller-enhanced tree models
      4. Testing internal navigation
    7. Summary
  14. 9. The table and treeTable Components
    1. The table component
      1. The table component in its most minimal usage
      2. Adding a selection listener
      3. Adding sorting
      4. Adding a button bar
      5. Adding detail data sub views and using a POJO data model
      6. Adding a search form and paging
      7. Adding banding and grids for better visibility
      8. Making use of JSF binding and Facelets for further encapsulation
        1. Creating the XHTML: the reduction to a single line
    2. The treeTable component
      1. The treeTable component in its most minimal usage
      2. Adding major table capabilities
    3. Summary
  15. 10. The Chart Component
    1. Where the chart component is and what it supports
      1. Bar charts
        1. Stacking the bar chart
      2. Pie charts
      3. Area charts
      4. Line charts
      5. ScatterPlot charts
      6. Radar charts
      7. Funnel charts
      8. Gauge charts
    2. Summary
  16. 11. Building a Wizard
    1. Defining an abstract wizard model
      1. The properties of the abstract wizard model
      2. Constructors of the abstract wizard
      3. Providing the current step, action, and actionListener methods
      4. Providing control for the number of wizard steps
      5. Providing control for the current step index
      6. Providing step incrementation and decrementation
      7. Abstract class design aspects
    2. Defining the concrete wizard
      1. Implementing the wizard's action listeners
      2. Implementing the wizard's navigation
      3. Implementing a step object
      4. Initializing a wizard instance
      5. The wizard's application inside the preparation controller
      6. Wizard implementation design aspects
    3. Defining the XHTML side—the wizard's face
    4. Summary
  17. 12. Dialogs: Pop-Up Your Web Application!
    1. Using the right scope: Seam or only Trinidad
      1. How the conversation is kept during a Trinidad dialog
    2. Defining a dialog-enabled navigation control
      1. Creating Trinidad dialogs in the navigation control
      2. Ensuring correct partial page rendering
      3. Standard context retrieval methods
      4. Calling the proper preparation method
      5. The resulting navigation point
    3. Making a dialog-enabled tree control
      1. Creating concrete tree contents
        1. Standard tree methods
        2. Providing navigational attributes
      2. The tree's navigation method
    4. Revisiting the wizard—few additions make it pop-up
    5. Summary
  18. A. References
    1. Links to the Apache MyFaces Trinidad web site
    2. References
      1. Chapter 1
      2. Chapter 2
      3. Chapter 3
      4. Chapter 4
      5. Chapter 5
      6. Chapter 6
      7. Chapter 7
      8. Chapter 8
      9. Chapter 9
      10. Chapter 10
      11. Chapter 11
      12. Chapter 12