The J2EETM Tutorial
Home   Search
Feedback

Contents

Foreword

Preface

Overview

Distributed Multitiered Applications
J2EE Components
J2EE Clients
Web Components
Business Components
Enterprise Information System Tier
J2EE Containers
Container Services
Container Types
Packaging
Development Roles
J2EE Product Provider
Tool Provider
Application Component Provider
Application Assembler
Application Deployer and Administrator
Reference Implementation Software
Database Access
J2EE APIs
Simplified Systems Integration
Tools

Getting Started

Setting Up
Getting the Example Code
Getting the Build Tool (ant)
Checking the Environment Variables
Starting the J2EE Server
Starting the deploytool
Creating the J2EE Application
Creating the Enterprise Bean
Coding the Enterprise Bean
Compiling the Source Files
Packaging the Enterprise Bean
Creating the J2EE Application Client
Coding the J2EE Application Client
Compiling the Application Client
Packaging the J2EE Application Client
Specifying the Application Client's Enterprise Bean Reference
Creating the Web Client
Coding the Web Client
Compiling the Web Client
Packaging the Web Client
Specifying the Web Client's Enterprise Bean Reference
Specifying the JNDI Names
Deploying the J2EE Application
Running the J2EE Application Client
Running the Web Client
Modifying the J2EE Application
Modifying a Class File
Adding a File
Modifying the Web Client
Modifying a Deployment Setting
Common Problems and Their Solutions
Cannot Start the J2EE Server
Compilation Errors
Deployment Errors
J2EE Application Client Runtime Errors
Web Client Runtime Errors
Detecting Problems With the Verifier Tool
Comparing Your EAR Files with Ours
When All Else Fails

Enterprise Beans

What Is an Enterprise Bean?
Benefits of Enterprise Beans
When to Use Enterprise Beans
Types of Enterprise Beans
What Is a Session Bean?
State Management Modes
When to Use Session Beans
What Is an Entity Bean?
What Makes Entity Beans Different from Session Beans?
Container-Managed Persistence
When to Use Entity 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
Remote Access
Local Access
Local Interfaces and Container-Managed Relationships
Deciding on Remote or Local Access
Performance and Access
Method Parameters and 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

A Session Bean Example

The CartEJB Example
Session Bean Class
Home Interface
Remote Interface
Helper Classes
Running the CartEJB Example
Other Enterprise Bean Features
Accessing Environment Entries
Comparing Enterprise Beans
Passing an Enterprise Bean's Object Reference

Bean-Managed Persistence Examples

The SavingsAccountEJB Example
Entity Bean Class
Home Interface
Remote Interface
Running the SavingsAccountEJB Example
deploytool Tips for Entity Beans With Bean-Managed Persistence
Mapping Table Relationships for Bean-Managed Persistence
One-to-One Relationships
One-to-Many Relationships
Many-to-Many Relationships
Primary Keys for Bean-Managed Persistence
The Primary Key Class
Primary Keys in the Entity Bean Class
Getting the Primary Key
Handling Exceptions

Container-Managed Persistence Examples

Overview of the RosterApp Application
The PlayerEJB Code
Entity Bean Class
Local Home Interface
Local Interface
A Guided Tour of the RosterApp Settings
RosterApp
RosterClient
RosterJAR
TeamJAR
Method Invocations in RosterApp
Creating a Player
Adding a Player to a Team
Removing a Player
Dropping a Player from a Team
Getting the Players of a Team
Getting a Copy of a Team's Players
Finding the Players by Position
Getting the Sports of a Player
Running the RosterApp Example
Setting Up
Deploying the Application
Running the Client
deploytool Tips for Entity Beans With Container-Managed Persistence
Specifying the Bean's Type
Selecting the Persistent Fields and Abstract Schema Name
Defining EJB QL Queries for Finder and Select Methods
Generating SQL and Specifying Table Creation
Specifying the Database JNDI Name, User Name, and Password
Defining Relationships
Primary Keys for Container-Managed Persistence
The Primary Key Class
Primary Keys in the Entity Bean Class
Generating Primary Key Values

A Message-Driven Bean Example

Example Application Overview
The J2EE Application Client
The Message-Driven Bean Class
The onMessage Method
The ejbCreate and ejbRemove Methods
Running the SimpleMessageEJB Example
Starting the J2EE Server
Creating the Queue
Deploying the Application
Running the Client
deploytool Tips for Message-Driven Beans
Specifying the Bean's Type and Transaction Management
Setting the Message-Driven Bean's Characteristics
deploytool Tips for JMS Clients
Setting the Resource References
Setting the Resource Environment References
Specifying the JNDI Names

Enterprise JavaBeans Query Language

Terminology
Simplified Syntax
Example Queries
Simple Finder Queries
Finder Queries That Navigate to Related Beans
Finder Queries with Other Conditional Expressions
Select Queries
Full Syntax
BNF Grammar of EJB QL
BNF Symbols
FROM Clause
Path Expressions
WHERE Clause
SELECT Clause
EJB QL Restrictions

Web Clients and Components

Web Client Life Cycle
Web Application Archives
Creating a WAR File
Adding a WAR File to an EAR File
Adding a Web Component to a WAR File
Configuring Web Clients
Application-Level Configuration
WAR-Level Configuration
Component-Level Configuration
Deploying Web Clients
Running Web Clients
Updating Web Clients
Internationalizing Web Clients

Java Servlet Technology

What Is a Servlet?
The Example Servlets
Troubleshooting
Servlet Life Cycle
Handling Servlet Life-Cycle Events
Handling Errors
Sharing Information
Using Scope Objects
Controlling Concurrent Access to Shared Resources
Accessing Databases
Initializing a Servlet
Writing Service Methods
Getting Information from Requests
Constructing Responses
Filtering Requests and Responses
Programming Filters
Programming Customized Requests and Responses
Specifying Filter Mappings
Invoking Other Web Resources
Including Other Resources in the Response
Transferring Control to Another Web Component
Accessing the Web Context
Maintaining Client State
Accessing a Session
Associating Attributes with a Session
Session Management
Session Tracking
Finalizing a Servlet
Tracking Service Requests
Notifying Methods to Shut Down
Creating Polite Long-Running Methods

JavaServer Pages Technology

What Is a JSP Page?
The Example JSP Pages
The Life Cycle of a JSP Page
Translation and Compilation
Execution
Initializing and Finalizing a JSP Page
Creating Static Content
Creating Dynamic Content
Using Objects within JSP Pages
JSP Scripting Elements
Including Content in a JSP Page
Transferring Control to Another Web Component
Param Element
Including an Applet
Extending the JSP Language

JavaBeans Components in JSP Pages

JavaBeans Component Design Conventions
Why Use a JavaBeans Component?
Creating and Using a JavaBeans Component
Setting JavaBeans Component Properties
Retrieving JavaBeans Component Properties

Custom Tags in JSP Pages

What is a Custom Tag?
The Example JSP Pages
Using Tags
Declaring Tag Libraries
Types of Tags
Defining Tags
Tag Handlers
Tag Library Descriptors
Simple Tags
Tags with Attributes
Tags With Bodies
Tags That Define Scripting Variables
Cooperating Tags
Examples
An Iteration Tag
A Template Tag Library
How Is a Tag Handler Invoked?

Transactions

What Is a Transaction?
Container-Managed Transactions
Transaction Attributes
Rolling Back a Container-Managed Transaction
Synchronizing a Session Bean's Instance Variables
Methods Not Allowed in Container-Managed Transactions
Bean-Managed Transactions
JDBC Transactions
JTA Transactions
Returning without Committing
Methods Not Allowed in Bean-Managed Transactions
Summary of Transaction Options for Enterprise Beans
Transaction Timeouts
Isolation Levels
Updating Multiple Databases
Transactions in Web Components

Security

Overview
Security Roles
Declaring and Linking Role References
Mapping Roles to J2EE Users and Groups
Web-Tier Security
Protecting Web Resources
Controlling Access to Web Resources
Authenticating Users of Web Resources
Using Programmatic Security in the Web Tier
Unprotected Web Resources
EJB-Tier Security
Declaring Method Permissions
Using Programmatic Security in the EJB Tier
Unprotected EJB-Tier Resources
Application Client-Tier Security
Specifying the Application Client's Callback Handler
EIS-Tier Security
Configuring Sign-On
Container-Managed Sign-On
Component-Managed Sign-On
Configuring Resource Adapter Security
Propagating Security Identity
Configuring a Component's Propagated Security Identity
Configuring Client Authentication
J2EE Users, Realms, and Groups
Managing J2EE Users and Groups
Setting Up a Server Certificate

Resource Connections

JNDI Names and Resource References
deploytool Tips for Resource References
Database Connections for Enterprise Beans
Coded Connections
Connection Pooling
Mail Session Connections
Running the ConfirmerEJB Example
URL Connections
Running the HTMLReaderEJB Example

J2EE Connector Architecture

About Resource Adapters
Resource Adapter Contracts
Administering Resource Adapters
The Black Box Resource Adapters
Transaction Levels
Properties
Configuring JDBC Drivers
Resource Adapter Tutorial
Setting Up
Deploying the Resource Adapter
Testing the Resource Adapter
Common Client Interface
Overview of the CCI
Programming with the CCI
Writing a CCI Client
CCI Tutorial

The Duke's Bank Application

Enterprise Beans
Session Beans
CustomerControllerEJB
TxControllerEJB
Entity Beans
Helper Classes
Database Tables
Protecting the Enterprise Beans
Application Client
The Classes and Their Relationships
BankAdmin Class
EventHandle Class
DataModel Class
Web Client
Design Strategies
Web Client Life Cycle
Protecting the Web Resources
Internationalization
Building, Packaging, Deploying, and Running the Application
Adding Groups and Users to the Realm
Starting the J2EE Server, deploytool, and Database
Compiling the Enterprise Beans
Packaging the Enterprise Beans
Compiling the Web Client
Packaging the Web Client
Compiling the J2EE Application Client
Packaging the J2EE Application Client
Packaging the Enterprise Archive File
Opening the Enterprise Archive File
Reviewing JNDI Names
Mapping the Security Roles to Groups
Deploying the Duke's Bank Application
Creating the Bank Database
Running the J2EE Application Client
Running the Web Client

HTTP Overview

HTTP Requests
HTTP Responses

J2EE SDK Tools

J2EE Administration Tool
Cleanup Tool
Cloudscape Server
Starting Cloudscape
Stopping Cloudscape
Running the Interactive SQL Tool
Cloudscape Server Configuration
Deployment Tool
J2EE Server
Key Tool
Packager Tool
EJB JAR File
Web Application WAR File
Application Client JAR File
J2EE Application EAR File
Specifying the Runtime Deployment Descriptor
Resource Adapter RAR File
Realm Tool
Examples
runclient Script
Syntax
Example
Accessing a Remote Server
Preventing the User Name and Password Prompts
Verifier Tool
Command-Line Verifier
Stand-Alone GUI Verifier

Examples

Glossary

Biographies

Index

Contents
Home   Search
Feedback