Prev | Next

TOC | Index

J2EE Doc Bundle Home

Revised: 05/02/00


JavaTM 2 Enterprise Edition
Developer's Guide (v. 1.2.1)

Table of Contents



Preface

Who Should Use This Book

Where to Find the Code Examples

How to PrintThis Book

Typographical Conventions

1. Overview

Benefits of Middle-Tier Servers

J2EE Architecture

J2EE Server
EJB Container
Web Container

Enterprise Beans

Session Beans
Entity Beans
Comparing Session and Entity Beans
Java BeansTM Components and Enterprise Beans
Programming Restrictions for Enterprise Beans
Database Access

J2EE Applications

Contents of a J2EE Application
Development Phases of J2EE Applications

2. Getting Started

Coding the Enterprise Bean

Coding the Remote Interface
Coding the Home Interface
Coding the Enterprise Bean Class
Compiling the Enterprise Bean's Source Code

Creating the J2EE Application

Packaging the Enterprise Bean

Deploying the J2EE Application

Building the Client

Coding the Client
Compiling the Client's Code

Running the Client

Solutions to Common Problems

Modifying the J2EE Application

3. Session Beans

A Session Bean Example

Session Bean Class
Home Interface
Remote Interface
Helper Classes

State Management Modes

Stateful Session Beans
Stateless Session Beans
Choosing Between Stateful and Stateless Session Beans

The Life Cycle of a Session Bean

The Stateful Session Bean Life Cycle
The Stateless Session Bean Life Cycle

Comparing Session Beans

Passing a Session Bean's Object Reference

Accessing Environment Entries

4. Entity Beans

Characteristics of Entity Beans

Persistence
Shared Access
Primary Key

A Bean-Managed Persistence Example

Entity Bean Class
Home Interface
Remote Interface
Tips on Running the AccountEJB Example

A Container-Managed Persistence Example

Container-Managed Fields
Entity Bean Class
The Finder Methods
Table Creation
Tips on Running the ProductEJB Example

Handling Exceptions

Primary Key Class

Creating a Primary Key Class
Getting the Primary Key

The Life Cycle of an Entity Bean

Comparing Entity Beans

Passing an Entity Bean's Object Reference

5. Database Connections

Coded Connections

How to Connect
When To Connect
Specifying the JNDI Name for Deployment
Specifying Database Users and Passwords

Container-Managed Connections

6. Transactions

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

Transaction Timeouts

Isolation Levels

Updating Multiple Databases

7. Clients

Stand-Alone JavaTM Applications

J2EE Application Clients

Accessing J2EE Services
Setting Up the Application for the J2EE Application Client
Creating the J2EE Application Client
Specifying the JNDI Name
Deploying the J2EE Application
Running the J2EE Application Client

Servlets

Setting Up the Servlet's J2EE Application
Coding the Servlet
Compiling the Servlet
Coding the HTML File
Creating the Servlet's .war File
Specifying the Web Context Root
Specifying the JNDI Names
Deploying the Servlet's J2EE Application
Running the Servlet

JavaServer PagesTM Components

Setting Up the JSP Component's J2EE Application
Writing the JSP File
Coding the JavaBeans Component
Compiling the JavaBeans Component
Creating the JSP Component's .war File
Specifying the Web Context Root
Specifying the JNDI Names
Deploying the JSP Component's J2EE Application
Running the JSP Component

Other Enterprise Beans

Setting Up the ShipperApp Application
Creating the Stock EJB .jar File
Creating the Shipper EJB .jar File
Specifying the JNDI Names
Deploying and Running the J2EE Application

8. Security

Authentication

J2EE Users, Realms, and Groups
Client Authentication
Managing J2EE Users and Groups

Authorization

Declaring Roles
Declaring Method Permissions
Mapping Roles to J2EE Users and Groups

Scenarios

J2EE Application Client
Web Browser Client

Bean-Managed Security

Getting the Caller's J2EE User
Determining the Caller's Role

Security Policy Files

Setting Up a Server Certificate

9. Advanced Topics

Mapping Table Relationships to Entity Beans

One-to-One Relationships
One-to-Many Relationships
Many-to-Many Relationships

Sending Email from an Enterprise Bean

Connecting to a URL in an Enterprise Bean

Accessing Enterprise Beans Through JSP Tag Libraries

Setting Up the ConverterJSPApp Application
Writing the JSP File
Writing the Tag Library Descriptor
Coding the Tag Handler Class
Coding the TagExtraInfo Class
Creating the Tag Library's .war File
Specifying the Web Context Root
Specifying the JNDI Names
Deploying the ConverterJSPApp Application
Running the ConverterJSPApp Application
Comparing the ConverterJSPApp and AccountJSPApp Applications

Deployment: Behind the Scenes

10. Running the J2EE Tools

Application Deployment Tool

Cleanup Script

Cloudscape Server

Starting and Stopping Cloudscape
Cloudscape Server Configuration
Cloudscape ij Tool

J2EE Server

Key Tool

Packager

EJB .jar File
Web Component .war File
Application Client .jar File
J2EE Application .ear File

Realm Tool

Runclient Script

Verifier

Command-Line Verifier
Stand-Alone GUI Verifier

Appendix A: Code Examples

Index



Prev | Next

TOC | Index


Copyright © 2000 Sun Microsystems, Inc. All rights reserved.