You are previewing Seam 2.x Web Development.
O'Reilly logo
Seam 2.x Web Development

Book Description

Build robust web applications with Seam, Facelets, and RichFaces using the JBoss application server

  • Develop rich web applications using Seam 2.x, Facelets, and RichFaces and deploy them on the JBoss Application Server

  • Integrate standard technologies like JSF, Facelets, EJB, and JPA with Seam and build on them using additional Seam components

  • Informative and practical approach to development with fully working examples and source code for each chapter of the book

In Detail

The Seam framework from JBoss allows developers to use JSF, Facelets, EJB, and JPA to write conversational web applications. But you will first have to learn how these standard technologies are integrated using Seam and how they can be built upon using additional Seam components. If you need to build a Java web application fast, but don't have time to learn all these complex features, then this book is for you.

The book provides a practical approach to developing Seam applications highlighting good development practices. It provides a complete walk through to develop Web applications using Seam, Facelets, and RichFaces and explains how to deploy them to the JBoss Application Server. You can start using key aspects of the Seam framework immediately because this book builds on them chapter by chapter, finally ending with details of enterprise functionality such as PDF report generation and event frameworks.

First, the book introduces you to the fundamentals of Seam applications, describing topics such as Injection, Outjection and Bijection. You will understand the Facelets framework, AJAX, database persistence, and advanced Seam concepts through the many examples in the book.

The book takes a practical approach throughout to describing the technologies and tools involved. You will add functionality to Seam applications after you learn how to use the Seam Generator RAD tools and how to customize and fully test application functionality. Hints and tips are provided along the way of how to use Seam and the JBoss Application Server.

Table of Contents

  1. Seam 2.x Web Development
  2. Credits
  3. About the author
  4. About the reviewers
  5. Preface
    1. What this book covers
    2. Who this book is for
    3. Conventions
    4. Reader feedback
    5. Customer support
      1. Downloading the example code for the book
      2. Errata
      3. Piracy
      4. Questions
  6. 1. Introduction to Seam
    1. What is Seam?
    2. Why use Seam?
    3. Seam requirements
    4. Installing JBoss Application Server
    5. Starting the JBoss Application Server
    6. Installing Seam
    7. Testing our Seam installation
      1. Start the JBoss Application Server
      2. Deploy the sample application
      3. Run the sample application
    8. Summary
  7. 2. Developing Seam Applications
    1. Seam application architecture
    2. Seam components
    3. Object Injection and Outjection
    4. Example application
      1. WAR file deployment descriptors
      2. EAR file deployment descriptors
      3. Application layout
      4. Testing the application
      5. Building and deploying the application
    5. Seam data validation
      1. Data validation
      2. Displaying errors to the user
      3. The JSF messages collection
    6. Building and testing the validating Seam calculator
    7. Summary
  8. 3. Seam Page Flow
    1. Simple navigation
    2. Seam style navigation
      1. Defining a page flow in pages.xml
        1. <page> element
        2. <navigation> element
        3. <rule> element
      2. Error handling
      3. Executing code before rendering pages
    3. A working example
      1. <s:selectItems/> and <s:convertEnum />
      2. Rendering the options in the sample application
      3. Running the sample application
    4. Seam jPDL navigation
    5. Summary
  9. 4. Facelets
    1. What is Facelets?
    2. Why Facelets? Why not JSP?
      1. Templating
        1. Template parameters
      2. Performance
      3. EL functions
      4. XHTML
      5. No scriptlets
    3. Obtaining and installing Facelets
    4. Configuring a web application for Facelets
      1. Changes in the web.xml file
      2. Changes in the faces-config.xml file
      3. Example Facelets files from the previous chapter
    5. SeamGen
    6. Creating the Vacation Planner application using SeamGen
    7. Seam debug page
    8. Summary
  10. 5. Testing Seam Applications
    1. Overview of Seam application testing
    2. TestNG
    3. Component testing
    4. Testing the user interface
    5. Seam component testing
    6. Mocking Seam components
    7. Summary
  11. 6. RichFaces
    1. Obtaining RichFaces
    2. Configuring an application for RichFaces
      1. Add JAR files to the web application
      2. Configuring the application's XML resources
    3. RichFaces controls
      1. <rich:calendar />
        1. JavaScript methods
      2. <rich:panel />
        1. JavaScript methods
    4. <rich:modalPanel />
        1. JavaScript methods
      1. <rich:simpleTogglePanel />
        1. JavaScript methods
      2. <rich:fileUpload />
        1. JavaScript methods
      3. <rich:gmap />
        1. JavaScript methods
      4. <rich:dataTable />
        1. JavaScript methods
    5. Summary
  12. 7. Database Persistence
    1. Overview of database persistence
    2. How SeamGen helps with persistence
    3. Persisting Java entities to the database
    4. Retrieving Java entities from the database
    5. Integrating Java entities with Facelets
    6. Relationships between entities
      1. One-to-one relationships
      2. One-to-many and many-to-one relationships
      3. Many-to-many relationships
    7. Performing CRUD operations on entities
    8. The Seam application framework
      1. Home objects
        1. Accessing home objects from Facelets
        2. XML definition of home objects
      2. Query objects
        1. Accessing query objects from Facelets
        2. XML definition of query objects
    9. Summary
  13. 8. Seam Conversations
    1. Component scope
      1. Local variables
      2. HTTP session data
      3. Global variables
    2. Seam component scope
      1. Defining the scope of a Seam component
          1. Stateless scope
          2. Event scope
          3. Page scope
          4. Conversation scope
          5. Session scope
          6. Business Process scope
          7. Application scope
    3. What are conversations?
      1. Starting a conversation
        1. Automatically starting a conversation when a page is viewed
      2. Ending a conversation
        1. Automatically ending a conversation when a page is viewed
      3. Propagating conversations between Windows
      4. Propagating conversations
      5. Viewing conversations
    4. Conversation configuration
      1. Conversation parameter
      2. Conversation timeout
      3. Concurrent request timeout
    5. Natural conversations
      1. Setting up a natural conversation
    6. Summary
  14. 9. Seam and AJAX
    1. What is AJAX?
    2. AJAX and the Seam Framework
    3. Configuring Seam applications for Seam Remoting
      1. Configuring Seam Remoting server side
      2. Configuring Seam Remoting client side
      3. Invoking Seam components via Remoting
      4. Debugging Seam Remoting
        1. The org.jboss.seam.remoting.remoting component
        2. The <remoting:remoting> component
      5. Logging
      6. Changing the Please wait message
    4. AJAX4JSF
      1. Configuring an application for AJAX4JSF
      2. AJAX4JSF tags
        1. <a4j:commandButton />
        2. <a4j:commandLink />
        3. <a4j:poll />
        4. <a4j:support />
    5. Summary
  15. 10. Security
    1. User authentication
      1. Security authenticator
        1. Persisting user information
        2. Creating an authenticator
        3. Securing web pages
        4. Creating a logon form
        5. Redirecting to the requested page after login
    2. User roles
      1. Implement a role class
      2. Add required Seam annotations
      3. Assign a set of roles to a user
      4. Restricting user interface access via roles
    3. Auditing security events
    4. CAPTCHAs
    5. The Seam identity manager API
      1. Creating a user with the identity manager
      2. Specifying security rules
      3. Defining security roles with rules
    6. OpenID
      1. Configuring a Seam web application to support OpenID
      2. Configure an OpenID phase listener
      3. Ensure that the correct JAR files are on the application's classpath
      4. Write a Logon form
      5. Configure page redirection after an OpenID logon
      6. The OpenID logon process
    7. Summary
  16. 11. Enterprise Features
    1. Internationalization
      1. Defining the application languages
      2. Write application-specific strings
      3. Display language-specific strings
      4. Dynamically changing the localization
      5. Persisting the localization settings
      6. SeamGen support for localization
      7. Displaying Hibernate Validator messages
    2. URL rewriting
      1. Enabling URL rewriting
    3. Seam events
      1. Raising events
        1. Raising events with @RaiseEvent
        2. Raising events with org.jboss.seam.core.Events
      2. Observing events
    4. PDF document generation
      1. PDF required configuration
      2. Generating PDFs
        1. <p:document />
        2. <p:paragraph />
        3. <p:text />
        4. <p:font />
        5. <p:table /> and <p:cell />
        6. <p:html />
    5. Email
      1. Configuring the SMTP settings
      2. Writing an email template
        1. <m:from />
        2. <m:to />
        3. <m:subject />
        4. <m:body />
        5. <m:attachment />
      3. Sending an email
    6. The future of Seam
    7. Summary
  17. A. JBoss Tools
    1. Overview of JBoss Tools
    2. Installing JBoss Tools
    3. Creating Seam projects
    4. Managing Seam projects
      1. JSP / Facelet editor
      2. Pages.xml editor
      3. Components.xml editor
    5. Running Seam projects
    6. Summary