You are previewing The Java™ EE 5 Tutorial, Third Edition: For Sun Java System Application Server Platform Edition 9.
O'Reilly logo
The Java™ EE 5 Tutorial, Third Edition: For Sun Java System Application Server Platform Edition 9

Book Description

The Java EE 5 Tutorial is an introduction to programming server-side Java applications. This book takes a task-oriented, example-driven approach to show you how to build applications for the Java EE 5 platform. This book also describes the features and functionalities available with NetBeans 5.5.

What's new in this edition? The author team have updated the existing chapters to reflect the changes to JSP, EJB, Servlets, and more. Also, the authors have added new chapters on the Sun Java System Application Server 9 as a deployment environment for server-side technologies. The web-tier technology chapters cover the components used in developing the presentation layer of a Java EE 5 or stand-alone web application. The web services technology chapters cover the APIs used in developing standard web services. The Enterprise JavaBeans (EJB) technology chapters cover the components used in developing the business logic of a Java EE 5 application. The Persistence technology chapters cover the Java Persistence API, which is used for accessing databases from Java EE applications. The platform services chapters cover the system services used by all the Java EE 5 component technologies

Table of Contents

  1. Copyright
  2. About This Tutorial
    1. Who Should Use This Tutorial
    2. Prerequisites
    3. How to Read This Tutorial
    4. About the Examples
      1. Required Software
        1. Tutorial Bundle
        2. Application Server
          1. Application Server Installation Tips
        3. NetBeans 5.5
        4. Apache Ant
        5. Registry Server
      2. Building the Examples
        1. Building the Examples Using NetBeans 5.5
        2. Building the Examples on the Command-Line Using Ant
      3. Tutorial Example Directory Structure
    5. Further Information
    6. Typographical Conventions
    7. Acknowledgments
    8. Feedback
  3. 1. Overview
    1. Java EE Application Model
    2. Distributed Multitiered Applications
      1. Security
      2. Java EE Components
      3. Java EE Clients
        1. Web Clients
        2. Applets
        3. Application Clients
        4. The JavaBeans™ Component Architecture
        5. Java EE Server Communications
      4. Web Components
      5. Business Components
      6. Enterprise Information System Tier
    3. Java EE Containers
      1. Container Services
      2. Container Types
    4. Web Services Support
      1. XML
      2. SOAP Transport Protocol
      3. WSDL Standard Format
      4. UDDI and ebXML Standard Formats
    5. Java EE Application Assembly and Deployment
    6. Packaging Applications
    7. Development Roles
      1. Java EE Product Provider
      2. Tool Provider
      3. Application Component Provider
        1. Enterprise Bean Developer
        2. Web Component Developer
        3. Application Client Developer
      4. Application Assembler
      5. Application Deployer and Administrator
    8. Java EE 5 APIs
      1. Enterprise JavaBeans Technology
      2. Java Servlet Technology
      3. JavaServer Pages Technology
      4. JavaServer Pages Standard Tag Library
      5. JavaServer Faces
      6. Java Message Service API
      7. Java Transaction API
      8. JavaMail API
      9. JavaBeans Activation Framework
      10. Java API for XML Processing
      11. Java API for XML Web Services (JAX-WS)
      12. Java Architecture for XML Binding (JAXB)
      13. SOAP with Attachments API for Java
      14. Java API for XML Registries
      15. J2EE Connector Architecture
      16. Java Database Connectivity API
      17. Java Persistence API
      18. Java Naming and Directory Interface
      19. Java Authentication and Authorization Service
      20. Simplified Systems Integration
    9. Sun Java System Application Server Platform Edition 9
      1. Tools
      2. Starting and Stopping the Application Server
      3. Starting the Admin Console
      4. Starting and Stopping the Java DB Database Server
      5. Debugging Java EE Applications
        1. Using the Server Log
        2. Using a Debugger
  4. One. The Web Tier
    1. 2. Getting Started with Web Applications
      1. Web Application Life Cycle
      2. Web Modules
        1. Packaging Web Modules
        2. Deploying a WAR File
          1. Setting the Context Root
          2. Deploying a Packaged Web Module
            1. Deploying with the Admin Console
            2. Deploying with asadmin
            3. Deploying with ant
            4. Deploying with NetBeans 5.5
        3. Testing Deployed Web Modules
        4. Listing Deployed Web Modules
        5. Updating Web Modules
          1. Updating a Packaged Web Module
          2. Dynamic Reloading
        6. Undeploying Web Modules
      3. Configuring Web Applications
        1. Mapping URLs to Web Components
          1. Setting the Component Alias
        2. Declaring Welcome Files
        3. Setting Initialization Parameters
        4. Mapping Errors to Error Screens
        5. Declaring Resource References
          1. Declaring a Reference to a Resource
          2. Declaring a Reference to a Web Service
      4. Duke’s Bookstore Examples
      5. Accessing Databases from Web Applications
        1. Populating the Example Database
        2. Creating a Data Source in the Application Server
      6. Further Information
    2. 3. Java Servlet Technology
      1. What Is a Servlet?
      2. The Example Servlets
        1. Troubleshooting
      3. Servlet Life Cycle
        1. Handling Servlet Life-Cycle Events
          1. Defining the Listener Class
          2. Specifying Event Listener Classes
        2. Handling Errors
      4. Sharing Information
        1. Using Scope Objects
        2. Controlling Concurrent Access to Shared Resources
        3. Accessing Databases
      5. Initializing a Servlet
      6. Writing Service Methods
        1. Getting Information from Requests
        2. Constructing Responses
      7. Filtering Requests and Responses
        1. Programming Filters
        2. Programming Customized Requests and Responses
        3. Specifying Filter Mappings
      8. Invoking Other Web Resources
        1. Including Other Resources in the Response
        2. Transferring Control to Another Web Component
      9. Accessing the Web Context
      10. Maintaining Client State
        1. Accessing a Session
        2. Associating Objects with a Session
          1. Notifying Objects That Are Associated with a Session
        3. Session Management
        4. Session Tracking
      11. Finalizing a Servlet
        1. Tracking Service Requests
        2. Notifying Methods to Shut Down
        3. Creating Polite Long-Running Methods
      12. Further Information
    3. 4. JavaServer Pages Technology
      1. What Is a JSP Page?
        1. Example
      2. The Example JSP Pages
      3. The Life Cycle of a JSP Page
        1. Translation and Compilation
        2. Execution
          1. Buffering
          2. Handling Errors
      4. Creating Static Content
        1. Response and Page Encoding
      5. Creating Dynamic Content
        1. Using Objects within JSP Pages
          1. Using Implicit Objects
          2. Using Application-Specific Objects
          3. Using Shared Objects
      6. Unified Expression Language
        1. Immediate and Deferred Evaluation Syntax
          1. Immediate Evaluation
          2. Deferred Evaluation
        2. Value and Method Expressions
          1. Value Expressions
            1. Referencing Objects Using Value Expressions
            2. Referring to Object Properties Using Value Expressions
            3. Where Value Expressions Can Be Used
          2. Method Expressions
        3. Defining a Tag Attribute Type
        4. Deactivating Expression Evaluation
        5. Literal Expressions
        6. Resolving Expressions
          1. Process of Expression Evaluation
          2. EL Resolvers
        7. Implicit Objects
        8. Operators
        9. Reserved Words
        10. Examples
        11. Functions
          1. Using Functions
          2. Defining Functions
      7. JavaBeans Components
        1. JavaBeans Component Design Conventions
        2. Creating and Using a JavaBeans Component
        3. Setting JavaBeans Component Properties
        4. Retrieving JavaBeans Component Properties
      8. Using Custom Tags
        1. Declaring Tag Libraries
        2. Including the Tag Library Implementation
      9. Reusing Content in JSP Pages
      10. Transferring Control to Another Web Component
        1. jsp:param Element
      11. Including an Applet
      12. Setting Properties for Groups of JSP Pages
        1. Deactivating EL Expression Evaluation
          1. Declaring Page Encodings
          2. Defining Implicit Includes
          3. Eliminating Extra White Space
      13. Further Information
    4. 5. JavaServer Pages Documents
      1. The Example JSP Document
      2. Creating a JSP Document
        1. Declaring Tag Libraries
        2. Including Directives in a JSP Document
        3. Creating Static and Dynamic Content
        4. Using the jsp:root Element
        5. Using the jsp:output Element
          1. Generating XML Declarations
          2. Generating a Document Type Declaration
      3. Identifying the JSP Document to the Container
    5. 6. JavaServer Pages Standard Tag Library
      1. The Example JSP Pages
      2. Using JSTL
        1. Tag Collaboration
      3. Core Tag Library
        1. Variable Support Tags
        2. Flow Control Tags
          1. Conditional Tags
          2. Iterator Tags
        3. URL Tags
        4. Miscellaneous Tags
      4. XML Tag Library
        1. Core Tags
        2. Flow Control Tags
        3. Transformation Tags
      5. Internationalization Tag Library
        1. Setting the Locale
        2. Messaging Tags
          1. The setBundle and bundle Tags
          2. The message Tag
        3. Formatting Tags
      6. SQL Tag Library
        1. query Tag Result Interface
      7. Functions
      8. Further Information
    6. 7. Custom Tags in JSP Pages
      1. What Is a Custom Tag?
      2. The Example JSP Pages
      3. Types of Tags
        1. Tags with Attributes
          1. Simple Attributes
          2. Fragment Attributes
          3. Dynamic Attributes
          4. Deferred Value
          5. Deferred Method
          6. Dynamic Attribute or Deferred Expression
          7. jsp:attribute Element
        2. Tags with Bodies
          1. jsp:body Element
        3. Tags That Define Variables
        4. Communication between Tags
      4. Encapsulating Reusable Content Using Tag Files
        1. Tag File Location
        2. Tag File Directives
          1. Declaring Tags
          2. body-content Attribute
          3. Declaring Tag Attributes in Tag Files
          4. Declaring Tag Variables in Tag Files
            1. Variable Synchronization
            2. Synchronization Examples
              1. AT_BEGIN Scope
              2. NESTED Scope
              3. AT_END Scope
              4. AT_BEGIN and name-from-attribute
        3. Evaluating Fragments Passed to Tag Files
        4. Examples
          1. Simple Attribute Example
          2. Simple and Fragment Attribute and Variable Example
          3. Dynamic Attribute Example
      5. Tag Library Descriptors
        1. Top-Level Tag Library Descriptor Elements
          1. validator Element
          2. listener Element
        2. Declaring Tag Files
          1. tag-file TLD Element
          2. Unpackaged Tag Files
          3. Packaged Tag Files
        3. Declaring Tag Handlers
          1. body-content Element
        4. Declaring Tag Attributes for Tag Handlers
        5. Declaring Tag Variables for Tag Handlers
      6. Programming Simple Tag Handlers
        1. Including Tag Handlers in Web Applications
        2. How Is a Simple Tag Handler Invoked?
        3. Tag Handlers for Basic Tags
        4. Tag Handlers for Tags with Attributes
          1. Defining Attributes in a Tag Handler
          2. Attribute Validation
          3. Setting Dynamic Attributes
          4. Setting Deferred Value Attributes and Deferred Method Attributes
        5. Tag Handlers for Tags with Bodies
          1. Tag Handler Does Not Manipulate the Body
          2. Tag Handler Manipulates the Body
        6. Tag Handlers for Tags That Define Variables
          1. TagExtraInfo Class
        7. Cooperating Tags
        8. Examples
          1. An Iteration Tag
            1. JSP Page
            2. Tag Handler
          2. A Template Tag Library
            1. JSP Pages
            2. Tag Handlers
    7. 8. Scripting in JSP Pages
      1. The Example JSP Pages
      2. Using Scripting
      3. Disabling Scripting
      4. Declarations
        1. Initializing and Finalizing a JSP Page
      5. Scriptlets
      6. Expressions
      7. Programming Tags That Accept Scripting Elements
        1. TLD Elements
        2. Tag Handlers
          1. How Is a Classic Tag Handler Invoked?
        3. Tags with Bodies
          1. Tag Handler Does Not Manipulate the Body
          2. Tag Handler Manipulates the Body
            1. doInitBody Method
            2. doAfterBody Method
            3. release Method
        4. Cooperating Tags
        5. Tags That Define Variables
    8. 9. JavaServer Faces Technology
      1. JavaServer Faces Technology Benefits
      2. What Is a JavaServer Faces Application?
      3. A Simple JavaServer Faces Application
        1. Steps in the Development Process
        2. Mapping the FacesServlet Instance
        3. Creating the Pages
          1. Declaring the Tag Libraries
          2. Adding the view and form Tags
          3. Adding a Label Component
          4. Adding an Image
          5. Adding a Text Field
          6. Registering a Validator on a Text Field
          7. Adding a Custom Message
          8. Adding a Button
          9. Displaying Error Messages
        4. Defining Page Navigation
        5. Configuring Error Messages
        6. Developing the Beans
        7. Adding Managed Bean Declarations
      4. User Interface Component Model
        1. User Interface Component Classes
        2. Component Rendering Model
        3. Conversion Model
        4. Event and Listener Model
        5. Validation Model
      5. Navigation Model
      6. Backing Beans
        1. Creating a Backing Bean Class
        2. Configuring a Bean
        3. Using the Unified EL to Reference Backing Beans
      7. The Life Cycle of a JavaServer Faces Page
        1. Restore View Phase
        2. Apply Request Values Phase
        3. Process Validations Phase
        4. Update Model Values Phase
        5. Invoke Application Phase
        6. Render Response Phase
      8. Further Information
    9. 10. Using JavaServer Faces Technology in JSP Pages
      1. The Example JavaServer Faces Application
      2. Setting Up a Page
      3. Using the Core Tags
      4. Adding UI Components to a Page Using the HTML Component Tags
        1. UI Component Tag Attributes
          1. The id Attribute
          2. The immediate Attribute
          3. The rendered Attribute
          4. The style and styleClass Attributes
          5. The value and binding Attributes
        2. Adding a Form Component
        3. Using Text Components
          1. Rendering a Text Field with the inputText Tag
          2. Rendering a Label with the outputLabel Tag
          3. Rendering a Hyperlink with the outputLink Tag
          4. Displaying a Formatted Message with the outputFormat Tag
          5. Rendering a Password Field with the inputSecret Tag
        4. Using Command Components for Performing Actions and Navigation
          1. Rendering a Button with the commandButton Tag
          2. Rendering a Hyperlink with the commandLink Tag
        5. Using Data-Bound Table Components
        6. Adding Graphics and Images with the graphicImage Tag
        7. Laying Out Components with the UIPanel Component
        8. Rendering Components for Selecting One Value
          1. Displaying a Checkbox Using the selectBooleanCheckbox Tag
          2. Displaying a Menu Using the selectOneMenu Tag
        9. Rendering Components for Selecting Multiple Values
        10. The UISelectItem, UISelectItems, and UISelectItemGroup Components
          1. Using the selectItems Tag
          2. Using the selectItem Tag
        11. Displaying Error Messages with the message and messages Tags
      5. Using Localized Data
        1. Loading a Resource Bundle
        2. Referencing Localized Static Data
        3. Referencing Error Messages
      6. Using the Standard Converters
        1. Converting a Component’s Value
        2. Using DateTimeConverter
        3. Using NumberConverter
      7. Registering Listeners on Components
        1. Registering a Value-Change Listener on a Component
        2. Registering an Action Listener on a Component
      8. Using the Standard Validators
        1. Validating a Component’s Value
        2. Using the LongRangeValidator
      9. Binding Component Values and Instances to External Data Sources
        1. Binding a Component Value to a Property
        2. Binding a Component Value to an Implicit Object
        3. Binding a Component Instance to a Bean Property
      10. Binding Converters, Listeners, and Validators to Backing Bean Properties
      11. Referencing a Backing Bean Method
        1. Referencing a Method That Performs Navigation
        2. Referencing a Method That Handles an Action Event
        3. Referencing a Method That Performs Validation
        4. Referencing a Method That Handles a Value-change Event
      12. Using Custom Objects
        1. Using a Custom Converter
        2. Using a Custom Validator
        3. Using a Custom Component
    10. 11. Developing with JavaServer Faces Technology
      1. Writing Bean Properties
        1. Writing Properties Bound to Component Values
          1. UIInput and UIOutput Properties
          2. UIData Properties
          3. UISelectBoolean Properties
          4. UISelectMany Properties
          5. UISelectOne Properties
          6. UISelectItem Properties
          7. UISelectItems Properties
            1. Properties for SelectItems Composed of SelectItem Instances
            2. Properties for SelectItems Composed of SelectItemGroup Instances
        2. Writing Properties Bound to Component Instances
        3. Writing Properties Bound to Converters, Listeners, or Validators
      2. Performing Localization
        1. Creating a Resource Bundle
        2. Localizing Dynamic Data
        3. Localizing Messages
          1. Creating a Message with a Message Factory
          2. Using FacesMessage to Create a Message
      3. Creating a Custom Converter
      4. Implementing an Event Listener
        1. Implementing Value-Change Listeners
        2. Implementing Action Listeners
      5. Creating a Custom Validator
        1. Implementing the Validator Interface
        2. Creating a Custom Tag
          1. Writing the Tag Handler
          2. Writing the Tag Library Descriptor
      6. Writing Backing Bean Methods
        1. Writing a Method to Handle Navigation
        2. Writing a Method to Handle an Action Event
        3. Writing a Method to Perform Validation
        4. Writing a Method to Handle a Value-Change Event
    11. 12. Creating Custom UI Components
      1. Determining Whether You Need a Custom Component or Renderer
        1. When to Use a Custom Component
        2. When to Use a Custom Renderer
        3. Component, Renderer, and Tag Combinations
      2. Understanding the Image Map Example
        1. Why Use JavaServer Faces Technology to Implement an Image Map?
        2. Understanding the Rendered HTML
        3. Understanding the JSP Page
        4. Configuring Model Data
        5. Summary of the Application Classes
      3. Steps for Creating a Custom Component
      4. Creating Custom Component Classes
        1. Specifying the Component Family
        2. Performing Encoding
        3. Performing Decoding
        4. Enabling Component Properties to Accept Expressions
        5. Saving and Restoring State
      5. Delegating Rendering to a Renderer
        1. Creating the Renderer Class
        2. Identifying the Renderer Type
      6. Handling Events for Custom Components
      7. Creating the Component Tag Handler
        1. Retrieving the Component Type
        2. Setting Component Property Values
          1. Getting the Attribute Values
          2. Setting the Component Property Values
            1. Setting Value Expressions on Component Properties
            2. Setting Method Expressions on Component Properties
        3. Providing the Renderer Type
        4. Releasing Resources
      8. Defining the Custom Component Tag in a Tag Library Descriptor
    12. 13. Configuring JavaServer Faces Applications
      1. Application Configuration Resource File
      2. Configuring Beans
        1. Using the managed-bean Element
        2. Initializing Properties Using the managed-property Element
          1. Referencing a Java Enum Type
          2. Referencing an Initialization Parameter
          3. Initializing Map Properties
          4. Initializing Array and List Properties
          5. Initializing Managed Bean Properties
        3. Initializing Maps and Lists
      3. Registering Custom Error Messages
      4. Registering Custom Localized Static Text
      5. Registering a Custom Validator
      6. Registering a Custom Converter
      7. Configuring Navigation Rules
      8. Registering a Custom Renderer with a Render Kit
      9. Registering a Custom Component
      10. Basic Requirements of a JavaServer Faces Application
        1. Configuring an Application with a Deployment Descriptor
          1. Identifying the Servlet for Life Cycle Processing
          2. Specifying a Path to an Application Configuration Resource File
          3. Specifying Where State Is Saved
          4. Encrypting Client State
          5. Restricting Access to JavaServer Faces Components
          6. Turning On Validation of XML Files
          7. Verifying Custom Objects
        2. Including the Required JAR Files
        3. Including the Classes, Pages, and Other Resources
    13. 14. Internationalizing and Localizing Web Applications
      1. Java Platform Localization Classes
      2. Providing Localized Messages and Labels
        1. Establishing the Locale
        2. Setting the Resource Bundle
        3. Retrieving Localized Messages
      3. Date and Number Formatting
      4. Character Sets and Encodings
        1. Character Sets
        2. Character Encoding
          1. Request Encoding
          2. Page Encoding
          3. Response Encoding
      5. Further Information
  5. Two. Web Services
    1. 15. Building Web Services with JAX-WS
      1. Setting the Port
      2. Creating a Simple Web Service and Client with JAX-WS
        1. Requirements of a JAX-WS Endpoint
        2. Coding the Service Endpoint Implementation Class
        3. Building, Packaging, and Deploying the Service
          1. Building, Packaging, and Deploying the Service Using NetBeans 5.5
          2. Building, Packaging, and Deploying the Service Using ant
            1. Undeploying the Service
            2. The all Task
        4. Testing the Service without a Client
        5. A Simple JAX-WS Client
          1. Coding the Client
          2. Building and Running the Client
            1. Building and Running the Client in NetBeans 5.5
            2. Building and Running the Client Using ant
      3. Types Supported by JAX-WS
      4. Web Services Interoperability and JAX-WS
      5. Further Information
    2. 16. Binding between XML Schema and Java Classes
      1. JAXB Architecture
        1. Architectural Overview
        2. The JAXB Binding Process
        3. More about Unmarshalling
        4. More about Marshalling
        5. More about Validation
      2. Representing XML Content
        1. Java Representation of XML Schema
      3. Binding XML Schemas
        1. Simple Type Definitions
        2. Default Data Type Bindings
          1. Schema-to-Java
          2. JAXBElement
          3. Java-to-Schema
      4. Customizing JAXB Bindings
        1. Schema-to-Java
        2. Java-to-Schema
      5. Examples
        1. JAXB Compiler Options
        2. JAXB Schema Generator Option
        3. About the Schema-to-Java Bindings
        4. Schema-Derived JAXB Classes
          1. Comment.java
          2. Items.java
          3. ObjectFactory.java
          4. PurchaseOrder.java
          5. PurchaseOrderType.java
          6. USAddress.java
      6. Basic Examples
        1. Modify Marshal Example
          1. Building and Running the Modify Marshal Example Using NetBeans 5.5
          2. Building and Running the Modify Marshal Example Using Ant
        2. Unmarshal Validate Example
          1. Building and Running the Unmarshal Validate Example Using NetBeans 5.5
          2. Building and Running the Unmarshal Validate Example Using Ant
      7. Customizing JAXB Bindings
        1. Why Customize?
        2. Customization Overview
          1. Inline and External Customizations
            1. Inline Customizations
            2. External Binding Customization Files
            3. Binding Customization File Format
            4. Passing Customization Files to the JAXB Binding Compiler
            5. Restrictions for External Binding Customizations
          2. Scope, Inheritance, and Precedence
          3. Customization Syntax
            1. Global Binding Declarations
            2. Schema Binding Declarations
            3. Class Binding Declarations
            4. Property Binding Declarations
            5. <javaType> Binding Declarations
            6. Typesafe Enumeration Binding Declarations
            7. <javadoc> Binding Declarations
          4. Customization Namespace Prefix
        3. Customize Inline Example
          1. Building and Running the Customize Inline Example Using NetBeans 5.5
          2. Building and Running the Customize Inline Example Using Ant
          3. Customized Schema
          4. Global Binding Declarations
          5. Schema Binding Declarations
          6. Class Binding Declarations
          7. Property Binding Declarations
          8. MyDatatypeConverter Class
        4. Datatype Converter Example
          1. Building and Running the Datatype Converter Example Using NetBeans 5.5
          2. Building and Running the Datatype Converter Example Using Ant
        5. Binding Declaration Files
          1. JAXB Version, Namespace, and Schema Attributes
            1. JAXB Version Number
            2. Namespace Declarations
            3. Schema Name and Schema Node
          2. Global and Schema Binding Declarations
          3. Class Declarations
        6. External Customize Example
          1. Building and Running the External Customize Example Using NetBeans 5.5
          2. Building and Running the External Customize Example Using Ant
      8. Java-to-Schema Examples
        1. j2s-create-marshal Example
          1. Building and Running the j2s-create-marshal Example Using NetBeans 5.5
          2. Building and Running the j2s-create-marshal Example Using Ant
        2. j2s-xmlAccessorOrder Example
          1. Using the @XmlAccessorOrder Annotation to Define Schema Element Ordering
          2. Using the @XmlType Annotation to Define Schema Element Ordering
          3. Schema Content Ordering in the Example
          4. Building and Running the j2s-xmlAccessorOrder Example Using NetBeans 5.5
          5. Building and Running the j2s-xmlAccessorOrder Example Using Ant
        3. j2s-xmlAdapter-field Example
          1. Building and Running the j2s-xmlAdapter-field Example Using NetBeans 5.5
          2. Building and Running the j2s-xmlAdapter-field Example Using Ant
        4. j2s-xmlAttribute-field Example
          1. Building and Running the j2s-xmlAttribute-field Example Using NetBeans 5.5
          2. Building and Running the j2s-xmlAttribute-field Example Using Ant
        5. j2s-xmlRootElement Example
          1. Building and Running the j2s-xmlRootElement Example Using NetBeans 5.5
          2. Building and Running the j2s-xmlRootElement Example Using Ant
        6. j2s-xmlSchemaType-class Example
          1. Building and Running the j2s-xmlSchemaType-class Example Using NetBeans 5.5
          2. Building and Running the j2s-xmlSchemaType-class Example Using Ant
        7. j2s-xmlType Example
          1. Building and Running the j2s-xmlType Example Using NetBeans 5.5
          2. Building and Running the j2s-xmlType Example Using Ant
      9. Further Information
    3. 17. Streaming API for XML
      1. Why StAX?
        1. Streaming versus DOM
        2. Pull Parsing versus Push Parsing
        3. StAX Use Cases
        4. Comparing StAX to Other JAXP APIs
      2. StAX API
        1. Cursor API
        2. Iterator API
          1. Iterator Event Types
          2. Example of Event Mapping
        3. Choosing between Cursor and Iterator APIs
          1. Development Goals
          2. Comparing Cursor and Iterator APIs
      3. Using StAX
        1. StAX Factory Classes
          1. XMLInputFactory
          2. XMLOutputFactory
          3. XMLEventFactory
        2. Resources, Namespaces, and Errors
          1. Resource Resolution
          2. Attributes and Namespaces
          3. Error Reporting and Exception Handling
        3. Reading XML Streams
          1. Using XMLStreamReader
            1. Reading Properties, Attributes, and Namespaces
            2. XMLStreamReader Methods
            3. Instantiating an XMLStreamReader
          2. Using XMLEventReader
            1. Reading Attributes
            2. Reading Namespaces
        4. Writing XML Streams
          1. Using XMLStreamWriter
          2. Using XMLEventWriter
            1. Attributes, Escaping Characters, Binding Prefixes
      4. Sun’s Streaming XML Parser Implementation
        1. Reporting CDATA Events
        2. Streaming XML Parser Factories Implementation
      5. Example Code
        1. Example Code Organization
        2. Example XML Document
        3. Cursor Example
          1. Stepping through Events
          2. Returning String Representations
          3. Building and Running the Cursor Example Using NetBeans 5.5
          4. Building and Running the Cursor Example Using Ant
        4. Cursor-to-Event Example
          1. Instantiating an XMLEventAllocator
          2. Creating an Event Iterator
          3. Creating the Allocator Method
          4. Building and Running the Cursor-to-Event Example Using NetBeans 5.5
          5. Building and Running the Cursor-to-Event Example Using Ant
        5. Event Example
          1. Creating an Input Factory
          2. Creating an Event Reader
          3. Creating an Event Iterator
          4. Getting the Event Stream
          5. Returning the Output
          6. Building and Running the Event Example Using NetBeans 5.5
          7. Building and Running the Event Example Using Ant
        6. Filter Example
          1. Implementing the StreamFilter Class
          2. Creating an Input Factory
          3. Creating the Filter
          4. Capturing the Event Stream
          5. Filtering the Stream
          6. Returning the Output
          7. Building and Running the Filter Example Using NetBeans 5.5
          8. Building and Running the Filter Example Using Ant
        7. Read-and-Write Example
          1. Creating an Event Producer/Consumer
          2. Creating an Iterator
          3. Creating a Writer
          4. Returning the Output
          5. Building and Running the Read-and-Write Example Using NetBeans 5.5
          6. Building and Running the Read-and-Write Example Using Ant
        8. Writer Example
          1. Creating the Output Factory
          2. Creating a Stream Writer
          3. Writing the Stream
          4. Returning the Output
          5. Building and Running the Writer Example Using NetBeans 5.5
          6. Building and Running the Writer Example Using Ant
      6. Further Information
    4. 18. SOAP with Attachments API for Java
      1. Overview of SAAJ
        1. Messages
          1. The Structure of an XML Document
          2. What Is in a Message?
            1. Messages with No Attachments
            2. Messages with Attachments
          3. SAAJ and DOM
        2. Connections
          1. SOAPConnection Objects
      2. Tutorial
        1. Creating and Sending a Simple Message
          1. Creating a Message
          2. Parts of a Message
          3. Accessing Elements of a Message
          4. Adding Content to the Body
          5. Getting a SOAPConnection Object
          6. Sending a Message
          7. Getting the Content of a Message
        2. Adding Content to the Header
        3. Adding Content to the SOAPPart Object
        4. Adding a Document to the SOAP Body
        5. Manipulating Message Content Using SAAJ or DOM APIs
        6. Adding Attachments
          1. Creating an AttachmentPart Object and Adding Content
          2. Accessing an AttachmentPart Object
        7. Adding Attributes
          1. Header Attributes
            1. The Actor Attribute
            2. The role Attribute
            3. The mustUnderstand Attribute
            4. The relay Attribute
        8. Using SOAP Faults
          1. Overview of SOAP Faults
          2. Creating and Populating a SOAPFault Object
          3. Retrieving Fault Information
      3. Code Examples
        1. Request.java
        2. MyUddiPing.java
          1. Examining MyUddiPing
          2. Accessing a Registry
          3. Building and Running MyUddiPing Using NetBeans 5.5
          4. Building and Running MyUddiPing Using Ant
          5. Troubleshooting MyUddiPing
        3. HeaderExample.java
          1. Building and Running HeaderExample
        4. DOMExample.java and DOMSrcExample.java
          1. Examining DOMExample
          2. Examining DOMSrcExample
          3. Building and Running DOMExample and DOMSrcExample
        5. Attachments.java
          1. Building and Running Attachments
        6. SOAPFaultTest.java
          1. Running SOAPFaultTest
      4. Further Information
    5. 19. Java API for XML Registries
      1. Overview of JAXR
        1. What Is a Registry?
        2. What Is JAXR?
        3. JAXR Architecture
      2. Implementing a JAXR Client
        1. Establishing a Connection
          1. Preliminaries: Getting Access to a Registry
          2. Obtaining a Connection Factory
          3. Creating a Connection
          4. Setting Connection Properties
          5. Obtaining and Using a RegistryService Object
        2. Querying a Registry
          1. Finding Organizations by Name
          2. Finding Organizations by Classification
          3. Finding Services and Service Bindings
        3. Managing Registry Data
          1. Getting Authorization from the Registry
          2. Creating an Organization
          3. Adding Classifications
          4. Adding Services and Service Bindings to an Organization
          5. Publishing an Organization
          6. Publishing a Specification Concept
          7. Removing Data from the Registry
        4. Using Taxonomies in JAXR Clients
          1. Defining a Taxonomy
          2. Specifying Postal Addresses
      3. Running the Client Examples
        1. Before You Compile the Examples
        2. Compiling the Examples
        3. Running the Examples
          1. Getting a List of Your Registry Objects
          2. Running the JAXRPublish Example
          3. Running the JAXRQuery Example
          4. Running the JAXRQueryByNAICSClassification Example
          5. Running the JAXRDelete Example
          6. Publishing a Classification Scheme
          7. Running the Postal Address Examples
          8. Deleting a Classification Scheme
          9. Publishing a Concept for a WSDL Document
          10. Publishing an Organization with a WSDL Document in Its Service Binding
          11. Running the JAXRQueryByWSDLClassification Example
          12. Deleting a Concept
          13. Other Targets
      4. Using JAXR Clients in Java EE Applications
        1. Coding the Application Client: MyAppClient.java
        2. Coding the PubQuery Session Bean
        3. Editing the Properties File
        4. Starting the Application Server
        5. Creating JAXR Resources
        6. Building, Deploying, and Running the Application Using NetBeans 5.5
        7. Building, Deploying, and Running the Application Using Ant
      5. Further Information
  6. Three. Enterprise Beans
    1. 20. Enterprise Beans
      1. What Is an Enterprise Bean?
        1. Benefits of Enterprise Beans
        2. When to Use Enterprise Beans
        3. Types of Enterprise Beans
      2. What Is a Session Bean?
        1. State Management Modes
          1. Stateful Session Beans
          2. Stateless Session Beans
        2. When to Use Session Beans
      3. What Is a Message-Driven Bean?
        1. What Makes Message-Driven Beans Different from Session Beans?
        2. When to Use Message-Driven Beans
      4. Defining Client Access with Interfaces
        1. Remote Clients
        2. Local Clients
        3. Deciding on Remote or Local Access
        4. Web Service Clients
        5. Method Parameters and Access
          1. Isolation
          2. Granularity of Accessed Data
      5. The Contents of an Enterprise Bean
      6. Naming Conventions for Enterprise Beans
      7. The Life Cycles of Enterprise Beans
        1. The Life Cycle of a Stateful Session Bean
        2. The Life Cycle of a Stateless Session Bean
        3. The Life Cycle of a Message-Driven Bean
      8. Further Information
    2. 21. Getting Started with Enterprise Beans
      1. Creating the Enterprise Bean
        1. Coding the Enterprise Bean
          1. Coding the Business Interface
          2. Coding the Enterprise Bean Class
        2. Compiling and Packaging the converter Example
          1. Compiling and Packaging the converter Example in NetBeans 5.5
          2. Compiling and Packaging the converter Example Using Ant
      2. Creating the Application Client
        1. Coding the Application Client
          1. Creating a Reference to an Enterprise Bean Instance
          2. Invoking a Business Method
          3. ConverterClient Source Code
        2. Compiling the Application Client
      3. Creating the Web Client
        1. Coding the Web Client
        2. Compiling the Web Client
      4. Deploying the Java EE Application
        1. Deploying the converter Example Using NetBeans 5.5
        2. Deploying the converter Example Using Ant
      5. Running the Application Client
        1. Running the Application Client Using NetBeans 5.5
        2. Running the Application Client Using Ant
      6. Running the Web Client
      7. Modifying the Java EE Application
        1. Modifying a Class File
    3. 22. Session Bean Examples
      1. The cart Example
        1. The Business Interface
        2. Session Bean Class
          1. Life-Cycle Callback Methods
          2. Business Methods
        3. The Remove Method
        4. Helper Classes
        5. Building, Packaging, Deploying, and Running the cart Example
          1. Building, Packaging, and Deploying the cart Example Using NetBeans 5.5
          2. Running the Application Client Using NetBeans 5.5
          3. Building, Packaging, and Deploying the cart Example Using Ant
          4. Running the Application Client Using Ant
          5. The all Task
        6. Undeploying the cart Example
      2. A Web Service Example: helloservice
        1. The Web Service Endpoint Implementation Class
        2. Stateless Session Bean Implementation Class
        3. Building, Packaging, Deploying, and Testing the helloservice Example
          1. Building, Packaging, and Deploying the helloservice Example Using NetBeans 5.5
          2. Building, Packaging, and Deploying the helloservice Example Using Ant
          3. Testing the Service without a Client
      3. Using the Timer Service
        1. The Timeout Method
        2. Creating Timers
        3. Canceling and Saving Timers
        4. Getting Timer Information
        5. Transactions and Timers
        6. The timersession Example
        7. Building, Packaging, Deploying, and Running the timersession Example
          1. Building, Packaging, Deploying, and Running the timersession Example Using NetBeans 5.5
          2. Building, Packaging, and Deploying the timersession Example Using Ant
          3. Running the Application Client Using Ant
      4. Handling Exceptions
    4. 23. A Message-Driven Bean Example
      1. Example Application Overview
      2. The Application Client
      3. The Message-Driven Bean Class
        1. The onMessage Method
      4. Packaging, Deploying, and Running the SimpleMessage Example
        1. Creating the Administered Objects
        2. Building, Deploying, and Running the Application Using NetBeans 5.5
        3. Building, Deploying, and Running the Application Using Ant
        4. Removing the Administered Objects
      5. Creating Deployment Descriptors for Message-Driven Beans
  7. Four. Persistence
    1. 24. Introduction to the Java Persistence API
      1. Entities
        1. Requirements for Entity Classes
        2. Persistent Fields and Properties in Entity Classes
          1. Persistent Fields
          2. Persistent Properties
        3. Primary Keys in Entities
          1. Primary Key Classes
        4. Multiplicity in Entity Relationships
        5. Direction in Entity Relationships
          1. Bidirectional Relationships
          2. Unidirectional Relationships
          3. Queries and Relationship Direction
          4. Cascade Deletes and Relationships
        6. Entity Inheritance
          1. Abstract Entities
          2. Mapped Superclasses
          3. Non-Entity Superclasses
          4. Entity Inheritance Mapping Strategies
            1. The Single Table per Class Hierarchy Strategy
            2. The Table per Concrete Class Strategy
            3. The Joined Subclass Strategy
      2. Managing Entities
        1. The Persistence Context
        2. The EntityManager
          1. Container-Managed Entity Managers
          2. Application-Managed Entity Managers
          3. Finding Entities Using the EntityManager
          4. Managing an Entity Instance’s Life Cycle
            1. Persisting Entity Instances
            2. Removing Entity Instances
            3. Synchronizing Entity Data to the Database
          5. Creating Queries
            1. Named Parameters in Queries
            2. Positional Parameters in Queries
        3. Persistence Units
          1. The persistence.xml File
    2. 25. Persistence in the Web Tier
      1. Accessing Databases from Web Applications
        1. Defining the Persistence Unit
        2. Creating an Entity Class
        3. Obtaining Access to an Entity Manager
        4. Accessing Data from the Database
        5. Updating Data in the Database
    3. 26. Persistence in the EJB Tier
      1. The order Application
        1. Entity Relationships in the order Application
          1. Self-Referential Relationships
          2. One-to-One Relationships
          3. One-to-Many Relationship Mapped to Overlapping Primary and Foreign Keys
          4. Unidirectional Relationships
        2. Primary Keys in the order Application
        3. Generated Primary Keys
          1. Compound Primary Keys
        4. Entity Mapped to More Than One Database Table
        5. Cascade Operations in the order Application
        6. BLOB and CLOB Database Types in the order Application
        7. Temporal Types in the order Application
        8. Managing the order Application’s Entities
          1. Creating Entities
          2. Finding Entities
          3. Setting Entity Relationships
          4. Using Queries
          5. Removing Entities
        9. Building and Running the order Application
          1. Creating the Database Tables in NetBeans 5.5
            1. Creating the Database Connection
            2. Creating the Tables
            3. Deleting the Tables
          2. Creating the Database Tables Using Ant
          3. Building, Packaging, Deploying, and Running order In NetBeans 5.5
          4. Building, Packaging, Deploying, and Running order Using Ant
            1. The all Task
            2. Undeploying order
      2. The roster Application
        1. Relationships in the roster Application
          1. The Many-To-Many Relationship in roster
        2. Entity Inheritance in the roster Application
        3. Automatic Table Generation in the roster Application
        4. Building and Running the roster Application
          1. Building, Packaging, Deploying, and Running roster in NetBeans 5.5
          2. Building, Packaging, Deploying, and Running roster Using Ant
            1. The all Task
            2. Undeploying order
    4. 27. The Java Persistence Query Language
      1. Terminology
      2. Simplified Syntax
        1. Select Statements
        2. Update and Delete Statements
      3. Example Queries
        1. Simple Queries
          1. A Basic Select Query
          2. Eliminating Duplicate Values
          3. Using Named Parameters
        2. Queries That Navigate to Related Entities
          1. A Simple Query with Relationships
          2. Navigating to Single-Valued Relationship Fields
          3. Traversing Relationships with an Input Parameter
          4. Traversing Multiple Relationships
          5. Navigating According to Related Fields
        3. Queries with Other Conditional Expressions
          1. The LIKE Expression
          2. The IS NULL Expression
          3. The IS EMPTY Expression
          4. The BETWEEN Expression
          5. Comparison Operators
        4. Bulk Updates and Deletes
          1. Update Queries
          2. Delete Queries
      4. Full Syntax
        1. BNF Symbols
        2. BNF Grammar of the Java Persistence Query Language
        3. FROM Clause
          1. Identifiers
          2. Identification Variables
            1. Range Variable Declarations
            2. Collection Member Declarations
            3. Joins
        4. Path Expressions
          1. Examples
          2. Expression Types
          3. Navigation
        5. WHERE Clause
          1. Literals
            1. String Literals
            2. Numeric Literals
            3. Boolean Literals
            4. Enum Literals
          2. Input Parameters
          3. Conditional Expressions
          4. Operators and Their Precedence
          5. BETWEEN Expressions
          6. IN Expressions
          7. LIKE Expressions
          8. NULL Comparison Expressions
          9. Empty Collection Comparison Expressions
          10. Collection Member Expressions
          11. Subqueries
            1. Exists Expressions
            2. ALL and ANY Expressions
          12. Functional Expressions
          13. NULL Values
          14. Equality Semantics
        6. SELECT Clause
          1. Return Types
            1. Aggregate Functions in the SELECT Clause
          2. The DISTINCT Keyword
          3. Constructor Expressions
        7. ORDER BY Clause
        8. The GROUP BY Clause
          1. The HAVING Clause
  8. Five. Services
    1. 28. Introduction to Security in Java EE
      1. Overview
        1. A Simple Example
          1. Step 1: Initial Request
          2. Step 2: Initial Authentication
          3. Step 3: URL Authorization
          4. Step 4: Fulfilling the Original Request
          5. Step 5: Invoking Enterprise Bean Business Methods
        2. Security Functions
        3. Characteristics of Application Security
      2. Security Implementation Mechanisms
        1. Java SE Security Implementation Mechanisms
        2. Java EE Security Implementation Mechanisms
          1. Application-Layer Security
          2. Transport-Layer Security
          3. Message-Layer Security
      3. Securing Containers
        1. Using Deployment Descriptors for Declarative Security
        2. Using Annotations
        3. Using Programmatic Security
      4. Securing the Application Server
      5. Working with Realms, Users, Groups, and Roles
        1. What Are Realms, Users, Groups, and Roles?
          1. What Is a Realm?
          2. What Is a User?
          3. What Is a Group?
          4. What Is a Role?
          5. Some Other Terminology
        2. Managing Users and Groups on the Application Server
          1. Adding Users to the Application Server
          2. Adding Users to the Certificate Realm
        3. Setting Up Security Roles
        4. Mapping Roles to Users and Groups
      6. Establishing a Secure Connection Using SSL
        1. Installing and Configuring SSL Support
        2. Specifying a Secure Connection in Your Application Deployment Descriptor
        3. Verifying SSL Support
          1. Tips on Running SSL
        4. Working with Digital Certificates
          1. Creating a Server Certificate
          2. Signing Digital Certificates
            1. Obtaining a Digitally Signed Certificate
          3. Using a Different Server Certificate with the Application Server
          4. Miscellaneous Commands for Certificates
        5. Enabling Mutual Authentication over SSL
          1. Creating a Client Certificate for Mutual Authentication
      7. Further Information
    2. 29. Securing Java EE Applications
      1. Securing Enterprise Beans
        1. Accessing an Enterprise Bean Caller’s Security Context
        2. Declaring Security Role Names Referenced from Enterprise Bean Code
          1. Declaring Security Roles Using Annotations
          2. Declaring Security Roles Using Deployment Descriptor Elements
        3. Defining a Security View of Enterprise Beans
          1. Defining Security Roles
            1. Linking Security Role References to Security Roles
          2. Specifying an Authentication Mechanism
          3. Specifying Method Permissions
            1. Specifying Method Permissions Using Annotations
            2. Specifying Method Permissions Using Deployment Descriptors
          4. Mapping Security Roles to Application Server Groups
          5. Propagating Security Identity
            1. Configuring a Component’s Propagated Security Identity
            2. Trust between Containers
        4. Using Enterprise Bean Security Annotations
        5. Using Enterprise Bean Security Deployment Descriptor Elements
        6. Configuring IOR Security
        7. Deploying Secure Enterprise Beans
          1. Accepting Unauthenticated Users
          2. Accessing Unprotected Enterprise Beans
      2. Enterprise Bean Example Applications
        1. Example: Securing an Enterprise Bean
          1. Annotating the Bean
          2. Setting Runtime Properties
          3. Building, Deploying, and Running the Secure Cart Example Using NetBeans 5.5
          4. Building, Deploying, and Running the Secure Cart Example Using Ant
        2. Example: Using the isCallerInRole and getCallerPrincipal Methods
          1. Modifying ConverterBean
          2. Modifying Runtime Properties for the Secure Converter Example
          3. Building, Deploying, and Running the Secure Converter Example Using NetBeans 5.5
          4. Building, Deploying, and Running the Secure Converter Example Using Ant
          5. Troubleshooting the Secure Converter Application
        3. Discussion: Securing the Duke’s Bank Example
      3. Securing Application Clients
        1. Using Login Modules
        2. Using Programmatic Login
      4. Securing EIS Applications
        1. Container-Managed Sign-On
        2. Component-Managed Sign-On
        3. Configuring Resource Adapter Security
        4. Mapping an Application Principal to EIS Principals
      5. Example Applications in the Application Server
      6. Further Information
    3. 30. Securing Web Applications
      1. Overview
      2. Working with Security Roles
        1. Declaring Security Roles
          1. Specifying Security Roles Using Annotations
          2. Specifying Security Roles Using Deployment Descriptor Elements
        2. Mapping Security Roles to Application Server Groups
      3. Checking Caller Identity Programmatically
        1. Declaring and Linking Role References
          1. Declaring Roles Using Annotations
          2. Declaring Roles Using Deployment Descriptor Elements
      4. Defining Security Requirements for Web Applications
        1. Declaring Security Requirements Using Annotations
          1. Using the @DeclareRoles Annotation
          2. Using the @RunAs Annotation
        2. Declaring Security Requirements in a Deployment Descriptor
          1. Specifying Security Constraints
            1. Specifying Separate Security Constraints for Different Resources
        3. Specifying a Secure Connection
        4. Specifying an Authentication Mechanism
          1. HTTP Basic Authentication
          2. Form-Based Authentication
            1. Using Login Forms
          3. HTTPS Client Authentication
            1. Mutual Authentication
          4. Digest Authentication
      5. Examples: Securing Web Applications
        1. Example: Using Form-Based Authentication with a JSP Page
          1. Creating a Web Client for Form-Based Authentication
          2. Creating the Login Form and the Error Page
          3. Specifying a Security Constraint
            1. Protecting Passwords with SSL
          4. Adding Authorized Roles and Users
          5. Mapping Application Roles to Application Server Groups
          6. Building, Packaging, and Deploying the Form-Based Authentication Example Using NetBeans 5.5
          7. Building, Packaging, and Deploying the Form-Based Authentication Example Using Ant
          8. Testing the Form-Based Authentication Web Client
        2. Example: Basic Authentication with a Servlet
          1. Declaring Security Roles
          2. Specifying the Security Constraint
            1. Protecting Passwords with SSL
          3. Adding Authorized Roles and Users
          4. Mapping Application Roles to Application Server Groups
          5. Building, Packaging, and Deploying the Servlet Basic Authentication Example Using NetBeans 5.5
          6. Building, Packaging, and Deploying the Servlet Basic Authentication Example Using Ant
          7. Running the Basic Authentication Servlet
          8. Troubleshooting the Basic Authentication Example
        3. Example: Basic Authentication with JAX-WS
          1. Annotating the Service
          2. Adding Security Elements to the Deployment Descriptor
          3. Linking Roles to Groups
          4. Building and Deploying HelloService with Basic Authentication Using NetBeans 5.5
          5. Building and Deploying HelloService with Basic Authentication Using Ant
          6. Building and Running the Client Application for HelloService with Basic Authentication Using NetBeans 5.5
          7. Building and Running the Client Application for HelloService with Basic Authentication Using Ant
      6. Further Information
    4. 31. The Java Message Service API
      1. Overview
        1. What Is Messaging?
        2. What Is the JMS API?
        3. When Can You Use the JMS API?
        4. How Does the JMS API Work with the Java EE Platform?
      2. Basic JMS API Concepts
        1. JMS API Architecture
        2. Messaging Domains
          1. Point-to-Point Messaging Domain
          2. Publish/Subscribe Messaging Domain
          3. Programming with the Common Interfaces
        3. Message Consumption
      3. The JMS API Programming Model
        1. Administered Objects
          1. Connection Factories
          2. Destinations
        2. Connections
        3. Sessions
        4. Message Producers
        5. Message Consumers
          1. Message Listeners
          2. Message Selectors
        6. Messages
          1. Message Headers
          2. Message Properties
          3. Message Bodies
        7. Queue Browsers
        8. Exception Handling
      4. Writing Simple JMS Client Applications
        1. A Simple Example of Synchronous Message Receives
          1. Writing the Client Programs
          2. Starting the JMS Provider
          3. Creating JMS Administered Objects
          4. Compiling and Packaging the Clients
          5. Running the Clients
        2. A Simple Example of Asynchronous Message Consumption
          1. Writing the Client Programs
          2. Compiling and Packaging the AsynchConsumer Client
          3. Running the Clients
        3. A Simple Example of Browsing Messages in a Queue
          1. Writing the Client Program
          2. Compiling and Packaging the MessageBrowser Client
          3. Running the Clients
        4. Running JMS Client Programs on Multiple Systems
          1. Creating Administered Objects for Multiple Systems
          2. Editing, Recompiling, Repackaging, and Running the Programs
          3. Deleting the Connection Factory and Stopping the Server
      5. Creating Robust JMS Applications
        1. Using Basic Reliability Mechanisms
          1. Controlling Message Acknowledgment
            1. A Message Acknowledgment Example
          2. Specifying Message Persistence
          3. Setting Message Priority Levels
          4. Allowing Messages to Expire
          5. Creating Temporary Destinations
        2. Using Advanced Reliability Mechanisms
          1. Creating Durable Subscriptions
            1. A Durable Subscription Example
          2. Using JMS API Local Transactions
            1. A Local Transaction Example
      6. Using the JMS API in a Java EE Application
        1. Using @Resource Annotations in Java EE Components
        2. Using Session Beans to Produce and to Synchronously Receive Messages
          1. Resource Management
          2. Transactions
        3. Using Message-Driven Beans
        4. Managing Distributed Transactions
        5. Using the JMS API with Application Clients and Web Components
      7. Further Information
    5. 32. Java EE Examples Using the JMS API
      1. A Java EE Application That Uses the JMS API with a Session Bean
        1. Writing the Application Components
          1. Coding the Application Client: MyAppClient.java
          2. Coding the Publisher Session Bean
          3. Coding the Message-Driven Bean: MessageBean.java
        2. Creating Resources for the Application
        3. Building, Deploying, and Running the Application Using NetBeans 5.5
        4. Building, Deploying, and Running the Application Using Ant
      2. A Java EE Application That Uses the JMS API with an Entity
        1. Overview of the Human Resources Application
        2. Writing the Application Components
          1. Coding the Application Client: HumanResourceClient.java
          2. Coding the Message-Driven Beans
          3. Coding the Entity Class
        3. Creating Resources for the Application
        4. Building, Deploying, and Running the Application Using NetBeans 5.5
        5. Building, Deploying, and Running the Application Using Ant
      3. An Application Example That Consumes Messages from a Remote Server
        1. Overview of the Modules
        2. Writing the Module Components
        3. Creating Resources for the Application
        4. Using Two Application Servers
        5. Building, Deploying, and Running the Modules Using NetBeans 5.5
        6. Building, Deploying, and Running the Modules Using Ant
      4. An Application Example That Deploys a Message-Driven Bean on Two Servers
        1. Overview of the Modules
        2. Writing the Module Components
          1. Coding the Application Client: MultiAppServerClient.java
          2. Coding the Message-Driven Bean: ReplyMsgBean.java
        3. Creating Resources for the Modules
        4. Using Two Application Servers
        5. Building, Deploying, and Running the Modules Using NetBeans 5.5
        6. Building, Deploying, and Running the Modules Using Ant
    6. 33. Transactions
      1. What Is a Transaction?
      2. Container-Managed Transactions
        1. Transaction Attributes
          1. Required
          2. RequiresNew
          3. Mandatory
          4. NotSupported
          5. Supports
          6. Never
          7. Summary of Transaction Attributes
          8. Setting Transaction Attributes
        2. Rolling Back a Container-Managed Transaction
        3. Synchronizing a Session Bean’s Instance Variables
        4. Methods Not Allowed in Container-Managed Transactions
      3. Bean-Managed Transactions
        1. JTA Transactions
        2. Returning without Committing
        3. Methods Not Allowed in Bean-Managed Transactions
      4. Transaction Timeouts
      5. Updating Multiple Databases
      6. Transactions in Web Components
    7. 34. Resource Connections
      1. Resources and JNDI Naming
      2. DataSource Objects and Connection Pools
      3. Resource Injection
        1. Field-Based Injection
        2. Method-Based Injection
        3. Class-Based Injection
          1. Declaring Multiple Resources
      4. The confirmer Example Application
        1. Running the confirmer Example Application
          1. Creating a Mail Session
          2. Building, Packaging, and Deploying confirmer in NetBeans 5.5
          3. Building, Packaging, and Deploying confirmer Using Ant
          4. Running the Client in NetBeans 5.5
          5. Running the Client Using Ant
      5. Further Information
    8. 35. Connector Architecture
      1. About Resource Adapters
      2. Resource Adapter Contracts
        1. Management Contracts
          1. Life-Cycle Management
          2. Work Management Contract
        2. Outbound Contracts
        3. Inbound Contracts
          1. Messaging Contracts
          2. Transaction Inflow
      3. Common Client Interface
      4. Further Information
  9. Six. Case Studies
    1. 36. The Coffee Break Application
      1. Common Code
      2. JAX-WS Coffee Supplier Service
        1. Service Implementation
      3. SAAJ Coffee Supplier Service
        1. SAAJ Client
          1. Sending the Request
          2. Extracting the Price List
          3. Ordering Coffee
            1. Creating the Order
            2. Retrieving the Order Confirmation
        2. SAAJ Service
          1. Returning the Price List
          2. Returning the Order Confirmation
      4. Coffee Break Server
        1. JSP Pages
          1. orderForm
          2. checkoutForm
          3. checkoutAck
        2. JavaBeans Components
          1. RetailPriceList
          2. ShoppingCart
          3. OrderConfirmations
          4. CheckoutFormBean
          5. CoffeeBreakBean
        3. RetailPriceListServlet
        4. Resource Configuration
      5. Building, Packaging, Deploying, and Running the Application
        1. Setting the Port
        2. Building, Packaging, and Deploying the JAX-WS Service
        3. Building, Packaging, and Deploying the SAAJ Service
        4. Building, Packaging, and Deploying the Coffee Break Server
        5. Running the Coffee Break Client
        6. Removing the Coffee Break Application
    2. 37. The Duke’s Bank Application
      1. Enterprise Beans
        1. Session Beans
          1. AccountControllerBean
          2. CustomerControllerBean
          3. TxControllerBean
        2. Java Persistence Entities
        3. Helper Classes
        4. Database Tables
          1. Tables Representing Business Entities
        5. Protecting the Enterprise Beans
      2. Application Client
        1. The Classes and Their Relationships
        2. BankAdmin Class
          1. Constructor
          2. Class Methods
      3. Web Client
        1. Design Strategies
        2. Client Components
        3. Request Processing
        4. Protecting the Web Client Resources
      4. Building, Packaging, Deploying, and Running the Application
        1. Setting Up the Servers
          1. Starting the Application Server
          2. Creating the Bank Database in NetBeans 5.5
          3. Creating the Bank Database Using Ant
          4. Adding Users and Groups to the File Realm
        2. Building, Packaging, and Deploying Duke’s Bank Using NetBeans 5.5
        3. Building, Packaging, and Deploying Duke’s Bank Using Ant
        4. Running the Application Client Using NetBeans 5.5
        5. Running the Application Client Using Ant
        6. Running the Web Client
  10. A. Java Encoding Schemes
    1. Further Information
  11. B. Preparation for Java EE Certification Exams
    1. CX-310-081: Sun Certified Web Component Developer
    2. SL-351: Business Component Development with Enterprise JavaBeans™ Technology
  12. About the Authors