0%

Book Description

A new edition of this title is available, ISBN-10: 0137129394 ISBN-13: 9780137129393

Discover JBoss Seam: the Unified Framework for Simpler, More Powerful Web Development

JBoss Seam integrates EJB 3.0 and JSF components under a unified framework that simplifies and accelerates Java EE web development. Now, JBoss Seam’s project leader and technology evangelist take you inside this powerful new technology, showing exactly how to put it to work. 

Michael Yuan and Thomas Heute show how JBoss Seam enables you to create web applications that would have been difficult or impossible with previous Java frameworks. Through hands-on examples and a complete case study application, you’ll learn how to leverage JBoss Seam’s breakthrough state management capabilities; integrate business processes and rules; use AJAX with Seam; and deploy your application into production, one step at a time. Coverage includes

How JBoss Seam builds on—and goes beyond—the Java EE platform

• Using the “Stateful Framework”: conversations, workspaces, concurrent conversations, and transactions

• Integrating the web and data components: validation, clickable data tables, and bookmarkable web pages

• Creating AJAX and custom UI components, enabling AJAX for existing JSF components, and JavaScript integration via Seam Remoting

• Managing business processes, defining stateful pageflows, and implementing rule-based security

• Testing and optimizing JBoss Seam applications

• Deploying in diverse environments: with Tomcat, with production databases, in clusters, without EJB 3, and more

* Download source code for this book’s case study application at http://michaelyuan.com/seam/.

www.prenhallprofessional.com

www.jboss.com

About This Book

About the Authors

Acknowledgments

Part I: Getting Started

Chapter 1: What Is Seam?

Chapter 2: Seam Hello World

Chapter 3: Recommended JSF Enhancements

Chapter 4: Rapid Application Development Tools

Part II: Stateful Applications Made Easy

Chapter 5: An Introduction to Stateful Framework

Chapter 6: A Simple Stateful Application

Chapter 7: Conversations

Chapter 8: Workspaces and Concurrent Conversations

Chapter 9: Transactions

Part III: Integrating Web and Data Components

Chapter 10: Validate Input Data

Chapter 11: Clickable Data Tables

Chapter 12: Bookmarkable Web Pages

Chapter 13: The Seam CRUD Application Framework

Chapter 14: Failing Gracefully

Part IV: AJAX Support

Chapter 15: Custom and AJAX UI Components

Chapter 16: Enabling AJAX for Existing Components

Chapter 17: Direct JavaScript Integration

Part V: Business Processes and Rules

Chapter 18: Managing Business Processes

Chapter 19: Stateful Pageflows

Chapter 20: Rule-Based Security Framework

Part VI: Testing Seam Applications

Chapter 21: Unit Testing

Chapter 22: Integration Testing

Part VII: Production Deployment

Chapter 23: Java EE 5.0 Deployment

Chapter 24: Seam Without EJB3

Chapter 25: Tomcat Deployment

Chapter 26: Using a Production Database

Chapter 27: Performance Tuning and Clustering

Appendix A: Installing and Deploying JBoss AS

Appendix B: Using Example Applications as Templates

Index

Table of Contents

  1. JBoss® Seam
    1. About This Book
    2. Acknowledgments
    3. About the Authors
    4. I. Getting Started
      1. 1. What Is Seam?
        1. 1.1. Integrate and Enhance Java EE Frameworks
          1. 1.1. Integrate and Enhance Java EE Frameworks
          2. 1.2. A Web Framework That Understands ORM
          3. 1.3. Designed for Stateful Web Applications
          4. 1.4. Web 2.0 Ready
          5. 1.5. POJO Services via Dependency Bijection
          6. 1.6. Configuration by Exception
          7. 1.7. Avoid XML Abuse
          8. 1.8. Designed for Testing
          9. 1.9. Great Tools Support
          10. 1.10. Let’s Start Coding!
      2. 2. Seam Hello World
        1. 2.1. Create a Data Model
          1. 2.1. Create a Data Model
          2. 2.2. Map the Data Model to a Web Form
          3. 2.3. Handle Web Events
          4. 2.4. More on the Seam Programming Model
            1. 2.4.1. Seam POJO Components
            2. 2.4.2. Seam Built-in Components
            3. 2.4.3. Ease of Testing
            4. 2.4.4. Getter/Setter-Based Bijection
            5. 2.4.5. Avoid Excessive Bijection
            6. 2.4.6. Page Navigation in JSF
            7. 2.4.7. Access Database via the EntityManager
          5. 2.5. Configuration and Packaging
            1. 2.5.1. The WAR File
            2. 2.5.2. The Seam Components JAR
          6. 2.6. How is this Simple?
      3. 3. Recommended JSF Enhancements
        1. 3.1. An Introduction to Facelets
          1. 3.1. An Introduction to Facelets
            1. 3.1.1. Why Facelets?
            2. 3.1.2. A Facelets Hello World
            3. 3.1.3. Use Facelets as a Template Engine
            4. 3.1.4. Data List Component
          2. 3.2. Seam JSF Enhancements
            1. 3.2.1. Seam UI Tags
            2. 3.2.2. Seam JSF EL Enhancement
            3. 3.2.3. Use EL Everywhere
            4. 3.2.4. Seam Filters
            5. 3.2.5. Stateful JSF
          3. 3.3. Add Facelets and Seam UI Support
          4. 3.4. PDF, Email, and Rich Text
            1. 3.4.1. Generate PDF Reports
            2. 3.4.2. Template-Based Email
            3. 3.4.3. Display Rich Text
      4. 4. Rapid Application Development Tools
        1. 4.1. Prerequisites
          1. 4.1. Prerequisites
          2. 4.2. A Quick Tutorial
            1. 4.2.1. Set Up Seam Gen
            2. 4.2.2. Generate a Skeleton Application
            3. 4.2.3. Understand the Profiles
            4. 4.2.4. Develop the Application
            5. 4.2.5. Build and Deploy
            6. 4.2.6. Run Test Cases
          3. 4.3. Work with IDEs
            1. 4.3.1. NetBeans
            2. 4.3.2. Eclipse
          4. 4.4. Generate CRUD Application from Database
    5. II. Stateful Applications Made Easy
      1. 5. An Introduction to Stateful Framework
        1. 5.1. Correct Usage of ORM
          1. 5.1. Correct Usage of ORM
          2. 5.2. Better Performance
          3. 5.3. Better Browser Navigation Support
          4. 5.4. Less Memory Leak
          5. 5.5. High Granularity Component Lifecycle
          6. 5.6. Reduce Boilerplate Code
      2. 6. A Simple Stateful Application
        1. 6.1. Stateful Components
          1. 6.1. Stateful Components
            1. 6.1.1. Stateful Entity Bean
            2. 6.1.2. Stateful Session Bean
            3. 6.1.3. Stateful Component Lifecycle
            4. 6.1.4. Factory Methods
          2. 6.2. Page Navigation Flow
      3. 7. Conversations
        1. 7.1. The Default Conversation Scope
          1. 7.1. The Default Conversation Scope
            1. 7.1.1. Display JSF Messages
          2. 7.2. Long-Running Conversations
            1. 7.2.1. Define a Long-Running Conversational Component
            2. 7.2.2. Start a Conversation
            3. 7.2.3. Inside the Conversation
            4. 7.2.4. End the Conversation
            5. 7.2.5. Links and Buttons
          3. 7.3. New Frontiers
      4. 8. Workspaces and Concurrent Conversations
        1. 8.1. What Is a Workspace?
          1. 8.1. What Is a Workspace?
          2. 8.2. Workspace Switcher
          3. 8.3. Carry a Conversation Across Workspaces
          4. 8.4. Managing the Conversation ID
      5. 9. Transactions
        1. 9.1. Managing a Transaction
          1. 9.1. Managing a Transaction
          2. 9.2. Forcing a Transaction Rollback
            1. 9.2.1. Rolling Back Transactions via Checked Exceptions
            2. 9.2.2. Rolling Back Transactions via Return Values
          3. 9.3. Atomic Conversation (Web Transaction)
            1. 9.3.1. Manual Flush of the Persistence Context
            2. 9.3.2. One Transaction per Conversation
            3. III. Integrating Web and Data Components
              1. 10. Validating Input Data
                1. 10.1. Form-Validation Basics
                  1. 10.1. Form-Validation Basics
                  2. 10.2. Validation Annotations on the Entity Bean
                  3. 10.3. Triggering the Validation Action
                  4. 10.4. Display Error Messages on the Web Form
                  5. 10.5. Use JSF Custom Validators
              2. 11. Clickable Data Tables
                1. 11.1. Implement a Clickable Data Table
                  1. 11.1. Implement a Clickable Data Table
                    1. 11.1.1. Display the Data Table
                    2. 11.1.2. Inject Selected Object into Event Handler
                    3. 11.1.3. Use Extended EL in Data Table
                  2. 11.2. Seam Data-Binding Framework
              3. 12. Bookmarkable Web Pages
                1. 12.1. Using Page Parameters
                  1. 12.1. Using Page Parameters
                  2. 12.2. The Java-Centric Approach
                    1. 12.2.1. Obtaining Query Parameters in an HTTP GET Request
                    2. 12.2.2. Load Data for the Page
                      1. 12.2.2.1. The @Factory Method
                      2. 12.2.2.2. The @Create Method
                    3. 12.2.3. Further Processing from the Bookmarked Page
              4. 13. The Seam CRUD Application Framework
                1. 13.1. Data Access Objects (DAOs)
                  1. 13.1. Data Access Objects (DAOs)
                  2. 13.2. Seam CRUD DAOs Are POJOs
                  3. 13.3. The Declarative Seam DAO Component
                    1. 13.3.1. Use Simpler Names for the Entity Object
                    2. 13.3.2. Retrieving and Displaying an Entity Object
                    3. 13.3.3. Initializing a New Entity Instance
                    4. 13.3.4. Success Messages
                  4. 13.4. Queries
                    1. 13.4.1. Dynamic Queries
                    2. 13.4.2. Displaying Multipage Query Results
              5. 14. Failing Gracefully
                1. 14.1. Why Not Standard Servlet Error Pages?
                  1. 14.1. Why Not Standard Servlet Error Pages?
                  2. 14.2. Set Up the Exception Filter
                  3. 14.3. Annotate Exceptions
                  4. 14.4. Use pages.xml for System Exceptions
                  5. 14.5. Debug Information Page
                    1. 14.5.1. The Facelets Debug Page
                    2. 14.5.2. The Seam Debug Page
                    3. IV. AJAX Support
                      1. 15. Custom and AJAX UI Components
                        1. 15.1. Partial Form Submission Example
                          1. 15.1. Partial Form Submission Example
                          2. 15.2. Auto-complete Text Input Example
                          3. 15.3. Use ICEfaces with Seam
                          4. 15.4. Other JSF Component Libraries
                      2. 16. Enabling AJAX for Existing Components
                        1. 16.1. AJAX Validator Example
                          1. 16.1. AJAX Validator Example
                          2. 16.2. Programmatic AJAX
                          3. 16.3. AJAX Buttons
                          4. 16.4. AJAX Containers
                          5. 16.5. Other Goodies
                          6. 16.6. Configuring Ajax4jsf
                          7. 16.7. Pros and Cons
                      3. 17. Direct JavaScript Integration
                        1. 17.1. AJAX Name Validation Example (Reloaded)
                          1. 17.1. AJAX Name Validation Example (Reloaded)
                            1. 17.1.1. Server-Side Component
                            2. 17.1.2. Triggering a JavaScript Event on the Web Page
                            3. 17.1.3. Making an AJAX Call
                          2. 17.2. The AJAX Progress Bar
                            1. 17.2.1. Seam Components
                            2. 17.2.2. Accessing Seam Components from JavaScript
                          3. 17.3. Integrating the Dojo Toolkit
                            1. 17.3.1. Visual Effects
                            2. 17.3.2. Input Widgets
                            3. V. Business Processes and Rules
                              1. 18. Managing Business Processes
                                1. 18.1. jBPM Basics and Vocabulary
                                  1. 18.1. jBPM Basics and Vocabulary
                                  2. 18.2. Application Users and jBPM Actors
                                  3. 18.3. Creating a Business Process
                                    1. 18.3.1. Defining the Process
                                    2. 18.3.2. Creating a Business Process Instance
                                    3. 18.3.3. Binding Data Objects in Process Scope
                                  4. 18.4. Managing Tasks
                                    1. 18.4.1. Implementing Business Logic for Tasks
                                    2. 18.4.2. Specifying a Task to Work On
                                    3. 18.4.3. Selecting a Task in the UI
                                      1. 18.4.3.1. The pooledTaskInstanceList Component
                                      2. 18.4.3.2. The pooledTask Component
                                      3. 18.4.3.3. The taskInstanceList Component
                                      4. 18.4.3.4. The taskInstanceListByType Component
                                  5. 18.5. jBPM Libraries and Configuration
                              2. 19. Stateful Pageflows
                                1. 19.1. Stateful Navigation Rules in pages.xml
                                  1. 19.1. Stateful Navigation Rules in pages.xml
                                  2. 19.2. Associating a Business Process with a Web Page
                                  3. 19.3. Pageflow and Stateful Conversation
                                  4. 19.4. Configuration
                              3. 20. Rule-Based Security Framework
                                1. 20.1. Authentication and User Roles
                                  1. 20.1. Authentication and User Roles
                                  2. 20.2. Declarative Access Control
                                    1. 20.2.1. Web Pages
                                    2. 20.2.2. UI Components
                                    3. 20.2.3. Method-Level Access Control
                                  3. 20.3. Rule-Based Access Control
                                    1. 20.3.1. Simple Access Rules
                                    2. 20.3.2. Per Instance Access Rules
                                    3. 20.3.3. Configuring JBoss Rules
                                    4. VI. Testing Seam Applications
                                      1. 21. Unit Testing
                                        1. 21.1. A Simple TestNG Test Case
                                          1. 21.1. A Simple TestNG Test Case
                                          2. 21.2. Simulating Dependency Bijection
                                          3. 21.3. Mocking the Database and Transaction
                                          4. 21.4. Loading the Test Infrastructure
                                      2. 22. Integration Testing
                                        1. 22.1. A Complete Test Script
                                          1. 22.1. A Complete Test Script
                                            1. 22.1.1. Simulating JSF Interactions
                                            2. 22.1.2. Using JSF EL Expressions
                                          2. 22.2. Accessing Seam Components Without the EL
                                            1. 22.2.1. Obtaining a Seam Component
                                            2. 22.2.2. Binding Values to the Component
                                            3. 22.2.3. Invoking UI Event Handler Method
                                            4. 22.2.4. Checking the Response
                                            5. VII. Production Deployment
                                              1. 23. Java EE 5.0 Deployment
                                                1. 23.1. JBoss AS 4.0.5
                                                  1. 23.1. JBoss AS 4.0.5
                                                  2. 23.2. JBoss AS 4.2.x and 5.x
                                                  3. 23.3. GlassFish
                                              2. 24. Seam Without EJB3
                                                1. 24.1. Seam POJO with JPA
                                                  1. 24.1. Seam POJO with JPA
                                                    1. 24.1.1. A Seam POJO Example
                                                    2. 24.1.2. Configuration
                                                    3. 24.1.3. Packaging
                                                  2. 24.2. Using Hibernate POJOs and API
                                                    1. 24.2.1. Using the Hibernate API
                                                    2. 24.2.2. Configuration
                                              3. 25. Tomcat Deployment
                                                1. 25.1. Packaging a POJO Application for Tomcat
                                                  1. 25.1. Packaging a POJO Application for Tomcat
                                                    1. 25.1.1. Bundling Support JARs
                                                    2. 25.1.2. Configuring the Transactional DataSource
                                                    3. 25.1.3. Bootstrapping the JBoss MicroContainer
                                                  2. 25.2. Packaging an EJB3 Application for Tomcat
                                                    1. 25.2.1. Bundling Necessary JARs in the WAR File
                                                    2. 25.2.2. Bundling Embeddable EJB3 Configuration Files
                                                    3. 25.2.3. Bootstrapping the JBoss MicroContainer
                                                    4. 25.2.4. Using an Alternative Data Source
                                              4. 26. Using a Production Database
                                                1. 26.1. Installing and Setting Up the Database
                                                  1. 26.1. Installing and Setting Up the Database
                                                  2. 26.2. Installing Database Driver
                                                  3. 26.3. Defining a DataSource
                                                  4. 26.4. Configuring the Persistence Engine
                                              5. 27. Performance Tuning and Clustering
                                                1. 27.1. Tuning Performance on a Single Server
                                                  1. 27.1. Tuning Performance on a Single Server
                                                    1. 27.1.1. Avoid Call by Value
                                                    2. 27.1.2. JVM Options
                                                    3. 27.1.3. Reducing Logging
                                                    4. 27.1.4. Tuning the HTTP Thread Pool
                                                    5. 27.1.5. Choosing Between Client- and Server-Side State Saving
                                                    6. 27.1.6. Using a Production Data Source
                                                    7. 27.1.7. Using a Second-Level Database Cache
                                                    8. 27.1.8. Using Database Transactions Carefully
                                                  2. 27.2. Clustering for Scalability and Failover
                                                    1. 27.2.1. Sticky Session Load Balancing
                                                    2. 27.2.2. State Replication
                                                    3. 27.2.3. Failover Architectures
                                              6. A. Installing and Deploying JBoss AS
                                                1. A.1. JDK 5.0 Is Required
                                                  1. A.1. JDK 5.0 Is Required
                                                  2. A.2. Installing JBoss AS
                                                  3. A.3. Deploying and Running Applications
                                              7. B. Using Example Applications as Templates
                                                1. B.1. Simple EJB3-Based Web Applications
                                                  1. B.1. Simple EJB3-Based Web Applications
                                                  2. B.2. POJO-Based Web Applications
                                                  3. B.3. Tomcat Applications
                                                  4. B.4. More Complex Applications
3.129.148.210