Apache MyFaces Trinidad 1.2: A Practical Guide

Apache MyFaces Trinidad 1.2: A Practical Guide
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 292 pages [ 235mm x 191mm ]
Release Date : December 2009
ISBN : 184719608X
ISBN 13 : 9781847196088
Author(s) : David Thomas
Topics and Technologies : All Books, Application Development, Web Development

Table of Contents

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

David Thomas

David Thomas is a developer and technical project manager of Java-based web applications and has well over 10 years of experience in various web technologies.

He began writing applications based on the Common Gateway Interface (CGI), HTML and Javascript, with a short Java Applets interlude.

The main occupation with Java began when Java took charge of the server. A series of Java Servlet applications were developed using an early, self-built Model-2 controller architecture. Java Server Pages (JSP) took hold for a rather long time and a couple of major, increasingly complex web applications were developed in combination with Struts.

Shortly after Java Server Faces 1.2 (JSF) emerged, began the development of a major JSF web application including the development of a high-level framework based on Apache My Faces Trinidad, Facelets and JBOSS Seam in the area of controlling. This project spawned a couple of sub projects so development continues up to the present day.

This is the author's first book which is highly influenced by the accumulated years of his experience in web technology.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Apache MyFaces Trinidad 1.2: A Practical Guide +    Instant Migration to HTML5 and CSS3 How-to [Instant] =
50% Off
the second eBook
Price for both: ₨105.40

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Integrate Trinidad with Facelets and Seam to get the most out of JSF
  • Tackle web application issues with the help of Seam
  • Create a panel-based Trinidad user interface using Trinidad forms and Facelet input components
  • Create a wizard based on Trinidad components
  • Create pop-up or main browser window dialogs using Trinidad dialog framework
  • Work with Trinidad's table technology features including the use of JSF binding
  • Get a grip on Trinidad's AJAX technology, or more adequately described, its partial page rendering technique (PPR)
  • Deploy your web applications using Seam-gen
  • Implement login, authorization, navigation, internationalization, and more
  • Master all the major concepts of Trinidad

Chapter 1: In this chapter, we introduce you to the Trinidad component library. We give a general idea of this component library, which areas are covered by its components, and compare it to other libraries. Finally, the integration of Trinidad and Seam is discussed.

Chapter 2: In this chapter, we take a look at Facelets as a basic means to structure and build pages using Facelet page composition, Facelet composition components, and JSTL.

Chapter 3: In this chapter, we discuss the Trinidad tags and their attributes in a structured approach. You will gain an insight into the design of Trinidad allowing you to draw an efficient mental map of the library and make an effective selection and application of tags.

Chapter 4: In this chapter, we introduce you to the Trinidad's AJAX technology, called PPR (Partial Page Rendering). PPR is inspected from two points of view – the pure tag-based partial rendering and the pure Java-side partial rendering techniques.

Chapter 5: In this chapter, we develop the basic parts of the web application that serves as our Trinidad example. We present using Seam-gen to rapidly deploy after each change of any file.

Chapter 6: In this chapter, we deal with Trinidad's panelAccordion and showDetailItem components to show how they can be combined to build panel-based, panel-wise collapsible content.

Chapter 7: In this chapter, we discuss how to combine Trinidad's tags and Facelet composition components to build highly flexible and well-formatted forms including messaging support.

Chapter 8: In this chapter, we deal with Trinidad's tree components and models and exemplify their application. We present an effective shortcut that makes Trinidad's tree support an easy and yet powerful technology.

Chapter 9: In this chapter, we deal with Trinidad's table and treeTable components and exemplify their application. We apply the components in an increasingly refined way revealing most of their features, one at a time.

Chapter 10: In this chapter, we deal with Trinidad's chart component and show its application. You will learn to competently set up representation parameters, so effectively achieving the intended representation focus and thus graphically materializing hidden information in an appropriate way.

Chapter 11: In this chapter, we deal with Trinidad's components to implement a wizard and show their application. We present a solution to avoid an existing Facelet problem.

Chapter 12: In this chapter, we discuss Trinidad's pop-up window techniques. We revisit Seam conversations to address Trinidad's and Seam's specific necessities for pop-up dialogs. We enhance the web application with a couple of pop-up windows including wizard pop-up support.

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.

A step-by-step, practical guide to creating and developing web applications with Trinidad and Seam


The book is a hands-on practical guide that stresses the discussion of code and builds up a sample application that illustrates all the standard UI types covered by Trinidad.

Who this book is for

This book is written for Java developers who are beginners at JSF and experienced web developers who are looking for an introduction into the world of open source JSF technology.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software