Foreword
About This Tutorial
Chapter 1: Overview
Distributed Multitiered Applications
Enterprise Information System Tier
UDDI and ebXML Standard Formats
Application Component Provider
Application Deployer and Administrator
Enterprise JavaBeans Technology
JavaBeans Activation Framework
SOAP with Attachments API for Java
Java Naming and Directory Interface
Java Authentication and Authorization Service
Simplified Systems Integration
Sun Java System Application Server Platform Edition 8
Starting and Stopping the Application Server
Starting the deploytool Utility
Starting and Stopping the Derby Database Server
Chapter 2: Understanding XML
Writing Processing Instructions
Substituting and Inserting Text
Creating a Document Type Definition
Defining Attributes and Entities in the DTD
Defining Parameter Entities and Conditional Sections
Designing an XML Data Structure
Chapter 3: Getting Started with Web Applications
Mapping URLs to Web Components
Setting Initialization Parameters
Mapping Errors to Error Screens
Accessing Databases from Web Applications
Populating the Example Database
Creating a Data Source in the Application Server
Specifying a Web Application's Resource Reference
Mapping the Resource Reference to a Data Source
Chapter 4: Java API for XML Processing
The Document Object Model APIs
The Extensible Stylesheet Language Transformations APIs
Chapter 5: Simple API for XML
Echoing an XML File with the SAX Parser
Implementing the ContentHandler Interface
Compiling and Running the Program
Adding Additional Event Handlers
Identifying the Document's Location
Handling Processing Instructions
Handling Errors with the Nonvalidating Parser
Displaying Special Characters and CDATA
Handling Text with XML-Style Syntax
Handling CDATA and Other Characters
DTD's Effect on the Nonvalidating Parser
Choosing Your Parser Implementation
Experimenting with Validation Errors
Error Handling in the Validating Parser
Using the DTDHandler and EntityResolver
Chapter 6: Document Object Model
Convert DomEcho to a GUI Application
Create Adapters to Display the DOM in a JTree
Examining the Structure of a DOM
Displaying a More Complex Tree
Constructing a User-Friendly JTree from a DOM
Creating and Manipulating a DOM
Obtaining a DOM from the Factory
Overview of the Validation Process
Configuring the DocumentBuilder Factory
Validating with Multiple Namespaces
Chapter 7: Extensible Stylesheet Language Transformations
Introducing XSL, XSLT, and XPath
The JAXP Transformation Packages
XPath Data Types and Operators
Writing Out a DOM as an XML File
Writing Out a Subtree of the DOM
Generating XML from an Arbitrary Data Structure
Modifying the Parser to Generate SAX Events
Using the Parser as a SAXSource
Transforming XML Data with XSLT
Defining a Simple <article> Document Type
Processing the Basic Structure Elements
Processing the Remaining Structure Elements
Process Inline (Content) Elements
Transforming from the Command Line with Xalan
Concatenating Transformations with a Filter Chain
Understanding How the Filter Chain Works
Chapter 8: Building Web Services with JAX-RPC
Creating a Simple Web Service and Client with JAX-RPC
Coding the Service Endpoint Interface and Implementation Class
Packaging and Deploying the Service
Dynamic Invocation Interface Client
Web Services Interoperability and JAX-RPC
Chapter 9: SOAP with Attachments API for Java
Creating and Sending a Simple Message
Adding Content to the SOAPPart Object
Adding a Document to the SOAP Body
Manipulating Message Content Using SAAJ or DOM APIs
DOMExample.java and DOMSrcExample.java
Chapter 10: Java API for XML Registries
Using Taxonomies in JAXR Clients
Before You Compile the Examples
Using JAXR Clients in J2EE Applications
Coding the Application Client: MyAppClient.java
Coding the PubQuery Session Bean
Starting the Application Server
Creating and Packaging the Application
Running the Application Client
Chapter 11: Java Servlet Technology
Handling Servlet Life-Cycle Events
Controlling Concurrent Access to Shared Resources
Getting Information from Requests
Filtering Requests and Responses
Programming Customized Requests and Responses
Including Other Resources in the Response
Transferring Control to Another Web Component
Associating Objects with a Session
Notifying Methods to Shut Down
Creating Polite Long-Running Methods
Chapter 12: JavaServer Pages Technology
Using Objects within JSP Pages
Deactivating Expression Evaluation
JavaBeans Component Design Conventions
Creating and Using a JavaBeans Component
Setting JavaBeans Component Properties
Retrieving JavaBeans Component Properties
Including the Tag Library Implementation
Transferring Control to Another Web Component
Setting Properties for Groups of JSP Pages
Chapter 13: JavaServer Pages Documents
Including Directives in a JSP Document
Creating Static and Dynamic Content
Identifying the JSP Document to the Container
Chapter 14: JavaServer Pages Standard Tag Library
Internationalization Tag Library
Chapter 15: Custom Tags in JSP Pages
Encapsulating Reusable Content Using Tag Files
Evaluating Fragments Passed to Tag Files
Top-Level Tag Library Descriptor Elements
Declaring Tag Attributes for Tag Handlers
Declaring Tag Variables for Tag Handlers
Programming Simple Tag Handlers
Including Tag Handlers in Web Applications
How Is a Simple Tag Handler Invoked?
Tag Handlers for Tags with Attributes
Tag Handlers for Tags with Bodies
Tag Handlers for Tags That Define Variables
Chapter 16: Scripting in JSP Pages
Initializing and Finalizing a JSP Page
Programming Tags That Accept Scripting Elements
Chapter 17: JavaServer Faces Technology
JavaServer Faces Technology Benefits
What Is a JavaServer Faces Application?
A Simple JavaServer Faces Application
Steps in the Development Process
Adding Managed Bean Declarations
User Interface Component Model
User Interface Component Classes
The Life Cycle of a JavaServer Faces Page
Request Processing Life Cycle Scenarios
Standard Request Processing Life Cycle
Chapter 18: Using JavaServer Faces Technology in JSP Pages
The Example JavaServer Faces Application
The UIInput and UIOutput Components
The UIMessage and UIMessages Components
The UISelectItem, UISelectItems, and UISelectItemGroup Components
Referencing a ResourceBundle from a Page
Referencing a Localized Message
Registering Listeners on Components
Registering a Value-Change Listener on a Component
Registering an Action Listener on a Component
Binding Component Values and Instances to External Data Sources
Binding a Component Value to a Property
Binding a Component Value to an Implicit Object
Binding a Component Instance to a Bean Property
Referencing a Backing Bean Method
Referencing a Method That Performs Navigation
Referencing a Method That Handles an Action Event
Referencing a Method That Performs Validation
Referencing a Method That Handles a Value-change Event
Chapter 19: Developing with JavaServer Faces Technology
Writing Properties Bound to Component Values
Writing Properties Bound to Component Instances
Implementing an Event Listener
Implementing Value-Change Listeners
Implementing the Validator Interface
Writing a Method to Handle Navigation
Writing a Method to Handle an Action Event
Writing a Method to Perform Validation
Writing a Method to Handle a Value-Change Event
Chapter 20: Creating Custom UI Components
Determining Whether You Need a Custom Component or Renderer
When to Use a Custom Component
Component, Renderer, and Tag Combinations
Understanding the Image Map Example
Why Use JavaServer Faces Technology to Implement an Image Map?
Understanding the Rendered HTML
Summary of the Application Classes
Steps for Creating a Custom Component
Creating the Component Tag Handler
Defining the Custom Component Tag in a Tag Library Descriptor
Creating Custom Component Classes
Specifying the Component Family
Enabling Value-Binding of Component Properties
Delegating Rendering to a Renderer
Handling Events for Custom Components
Chapter 21: Configuring JavaServer Faces Applications
Application Configuration Resource File
Using the managed-bean Element
Initializing Properties using the managed-property Element
Registering a Custom Validator
Registering a Custom Converter
Registering a Custom Renderer with a Render Kit
Registering a Custom Component
Basic Requirements of a JavaServer Faces Application
Configuring an Application Using deploytool
Including the Required JAR Files
Including the Classes, Pages, and Other Resources
Chapter 22: Internationalizing and Localizing Web Applications
Java Platform Localization Classes
Providing Localized Messages and Labels
Chapter 23: Enterprise Beans
What Makes Entity Beans Different from Session Beans?
What Is a Message-Driven Bean?
What Makes Message-Driven Beans Different from Session and Entity Beans?
When to Use Message-Driven Beans
Defining Client Access with Interfaces
Local Interfaces and Container-Managed Relationships
Deciding on Remote or Local Access
The Contents of an Enterprise Bean
Naming Conventions for Enterprise Beans
The Life Cycles of Enterprise Beans
The Life Cycle of a Stateful Session Bean
The Life Cycle of a Stateless Session Bean
The Life Cycle of an Entity Bean
The Life Cycle of a Message-Driven Bean
Chapter 24: Getting Started with Enterprise Beans
Creating the Application Client
Compiling the Application Client
Packaging the Application Client
Specifying the Application Client's Enterprise Bean Reference
Specifying the Web Client's Enterprise Bean Reference
Mapping the Enterprise Bean References
Specifying the Web Client's Context Root
Deploying the J2EE Application
Running the Application Client
Modifying the J2EE Application
Modifying a Deployment Setting
Chapter 25: Session Bean Examples
Packaging the Application Client
A Web Service Example: HelloServiceBean
Web Service Endpoint Interface
Stateless Session Bean Implementation Class
Building the Web Service Client
Running the Web Service Client
Other Enterprise Bean Features
Passing an Enterprise Bean's Object Reference
Chapter 26: Bean-Managed Persistence Examples
The SavingsAccountBean Example
Running the SavingsAccountBean Example
Mapping Table Relationships for Bean-Managed Persistence
Primary Keys for Bean-Managed Persistence
Primary Keys in the Entity Bean Class
deploytool Tips for Entity Beans with Bean-Managed Persistence
Chapter 27: Container-Managed Persistence Examples
Overview of the RosterApp Application
Method Invocations in RosterApp
Getting a Copy of a Team's Players
Finding the Players by Position
Getting the Sports of a Player
Building and Running the RosterApp Example
Creating the Enterprise Application
Packaging the Enterprise Beans
Packaging the Enterprise Application Client
Deploying the Enterprise Application
Running the Client Application
A Guided Tour of the RosterApp Settings
Primary Keys for Container-Managed Persistence
Advanced CMP Topics: The OrderApp Example
Bean Relationships in OrderApp
Primary Keys in OrderApp's Entity Beans
Entity Bean Mapped to More Than One Database Table
BLOB and CLOB Database Types in OrderApp
Building and Running the OrderApp Example
deploytool Tips for Entity Beans with Container-Managed Persistence
Selecting the Persistent Fields and Abstract Schema Name
Defining EJB QL Queries for Finder and Select Methods
Creating the Database Tables at Deploy Time in deploytool
Chapter 28: A Message-Driven Bean Example
The ejbCreate and ejbRemove Methods
Deploying and Running SimpleMessageApp
Creating the Administered Objects
Removing the Administered Objects
deploytool Tips for Message-Driven Beans
Setting the Message-Driven Bean's Characteristics
deploytool Tips for Components That Send Messages
Setting the Resource References
Setting the Message Destination References
Setting the Message Destinations
Chapter 29: Enterprise JavaBeans Query Language
Finder Queries That Navigate to Related Beans
Finder Queries with Other Conditional Expressions
Chapter 30: Transactions
Container-Managed Transactions
Rolling Back a Container-Managed Transaction
Synchronizing a Session Bean's Instance Variables
Compiling the BankBean Example
Packaging the BankBean Example
Methods Not Allowed in Container-Managed Transactions
Deploying and Running the WarehouseBean Example
Compiling the WarehouseBean Example
Packaging the WarehouseBean Example
Deploying and Running the TellerBean Example
Compiling the TellerBean Example
Packaging the TellerBean Example
Methods Not Allowed in Bean-Managed Transactions
Summary of Transaction Options for Enterprise Beans
Transactions in Web Components
Chapter 31: Resource Connections
DataSource Objects and Connection Pools
Specifying a Resource Reference
Running the ConfirmerBean Example
Running the HTMLReaderBean Example
Chapter 32: Security
Realms, Users, Groups, and Roles
Mapping Roles to Users and Groups
Setting Security Requirements Using deploytool
Specifying a Secure Connection
Using Programmatic Security in the Web Tier
Understanding Login Authentication
Using HTTP Basic Authentication
Using Form-Based Authentication
Using Client-Certificate Authentication
Example: Using Form-Based Authentication
Installing and Configuring SSL Support
What Is Secure Socket Layer Technology?
Understanding Digital Certificates
Example: Basic Authentication with JAX-RPC
Example: Client-Certificate Authentication over HTTP/SSL with JAX-RPC
Using Programmatic Security in the EJB Tier
Application Client-Tier Security
Configuring Resource Adapter Security
Configuring a Component's Propagated Security Identity
Configuring Client Authentication
What Is Java Authorization Contract for Containers?
Chapter 33: The Java Message Service API
How Does the JMS API Work with the J2EE Platform?
Writing Simple JMS Client Applications
A Simple Example of Synchronous Message Receives
A Simple Example of Asynchronous Message Consumption
Running JMS Client Programs on Multiple Systems
Creating Robust JMS Applications
Using Basic Reliability Mechanisms
Using Advanced Reliability Mechanisms
Using the JMS API in a J2EE Application
Using Session and Entity Beans to Produce and to Synchronously Receive Messages
Managing Distributed Transactions
Using the JMS API with Application Clients and Web Components
Chapter 34: J2EE Examples Using the JMS API
A J2EE Application That Uses the JMS API with a Session Bean
Writing the Application Components
Creating and Packaging the Application
Running the Application Client
A J2EE Application That Uses the JMS API with an Entity Bean
Overview of the Human Resources Application
Writing the Application Components
Creating and Packaging the Application
Running the Application Client
An Application Example That Consumes Messages from a Remote J2EE Server
Writing the Application Components
Creating and Packaging the Applications
Running the Application Client
An Application Example That Deploys a Message-Driven Bean on Two J2EE Servers
Writing the Application Components
Creating and Packaging the Applications
Running the Application Client
Chapter 35: The Coffee Break Application
JAX-RPC Coffee Supplier Service
Publishing the Service in the Registry
Deleting the Service From the Registry
JavaServer Faces Version of Coffee Break Server
Building, Packaging, Deploying, and Running the Application
Setting the Registry Properties
Building, Packaging, and Deploying the JAX-RPC Service
Building, Packaging, and Deploying the SAAJ Service
Building, Packaging, and Deploying the Coffee Break Server
Building, Packaging, and Deploying the JavaServer Faces Technology Coffee Break Server
Running the Coffee Break Client
Removing the Coffee Break Application
Chapter 36: The Duke's Bank Application
Protecting the Enterprise Beans
The Classes and Their Relationships
Protecting the Web Client Resources
Building, Packaging, Deploying, and Running the Application
Compiling the Duke's Bank Application Code
Packaging and Deploying the Duke's Bank Application
Running the Application Client
Appendix A: Java Encoding Schemes
Appendix B: XML and Related Specs: Digesting the Alphabet Soup
Linking and Presentation Standards
Appendix C: HTTP Overview
Appendix D: J2EE Connector Architecture
Glossary
About the Authors
Index