Home > Store

J2EE Tutorial, The, 2nd Edition

J2EE Tutorial, The, 2nd Edition


  • Sorry, this book is no longer in print.
Not for Sale

Also available in other formats.

Register your product to gain access to bonus material or receive a coupon.



Discover the ins-and-outs of the new J2EE 1.4 platform and learn how to build J2EE applications with the latest edition of this tutorial.

° Proven tutorial retains its popular approach to show the reader how to build applications for the J2EE 1.4 platform

° Part of The Java Series from Addison-Wesley; late June product launch at JavaOne in San Francisco

° Thorough coverage of Java servlets, JSP, EJB, security, and much more!


  • Copyright 2004
  • Edition: 2nd
  • Book
  • ISBN-10: 0-321-24575-X
  • ISBN-13: 978-0-321-24575-5

The J2EE™ Tutorial, Second Edition, is the complete guide to all major components of the Java 2 Platform, Enterprise Edition (J2EE) version 1.4. Written by members of the J2EE platform team at Sun Microsystems, this is the task-oriented and example-driven book that will have new and intermediate Java programmers building J2EE applications right away.

The first chapters introduce the J2EE 1.4 platform architecture and APIs, the Sun Java System Application Server Platform Edition 8, and the basics of working with XML and Web applications. The greater part of the book is devoted to describing and demonstrating the Java XML, Web-tier, and Enterprise JavaBeans technologies and platform services. Extensive examples and case studies show you how to put these technologies to work in the real world.

The technologies and services detailed include:

  • Java API for XML Processing (JAXP)
  • Java API for XML-Based RPC (JAX-RPC)
  • SOAP with Attachments API for Java (SAAJ)
  • Java API for XML Registries (JAXR)
  • Java Servlet
  • JavaServer Pages (JSP)
  • JSP Standard Tag Library (JSTL)
  • JavaServer Faces
  • Internationalization and localization
  • Enterprise JavaBeans (EJB)
  • Transactions
  • Resource connections
  • Security
  • Java Message Service API (JMS API)

The J2EE™ Tutorial, Second Edition, will give you a head start in developing and deploying J2EE applications.

The accompanying CD-ROM includes the tutorial examples (binary and source code) and the J2EE Software Development Kit, Enterprise Edition 1.4 (J2EE 1.4 SDK), which contains the Sun Java System Application Server Platform Edition 8, Java 2 Software Development Kit (J2SE SDK), and BluePrints sample applications.


Related Article

Tips for J2EE Development

Sample Content

Online Sample Chapter

Using JavaServer Faces Technology in JSP Pages

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents


About This Tutorial.

1. Overview.

Distributed Multitiered Applications.2

J2EE Containers.

Web Services Support.

Packaging Applications.

Development Roles.

J2EE 1.4 Platform APIs.

Sun Java System Application Server Platform Edition 8.

2. Understanding XML.

Introduction to XML.

Generating XML Data.

Designing an XML Data Structure.


3. Getting Started with Web Applications.

Web Application Life Cycle.

Web Modules.

Configuring Web Applications.

Duke's Bookstore Examples.

Accessing Databases from Web Applications.

Further Information.

4. Java API for XML Processing.


An Overview of the Packages.

The Simple API for XML APIs.

The Document Object Model APIs.

The Extensible Stylesheet Language Transformations APIs.

Using the JAXP Libraries.

Where Do You Go from Here?

5. Simple API for XML.

When to Use SAX.

Adding Additional Event Handlers.

Handling Errors with the Nonvalidating Parser.

Displaying Special Characters and CDATA.

Parsing with a DTD.

Choosing Your Parser Implementation.

Using the Validating Parser.

Parsing a Parameterized DTD.

Handling Lexical Events.

Using the DTDHandler and EntityResolver.

Further Information.

6. Document Object Model.

When to Use DOM.

Reading XML Data into a DOM.

Displaying a DOM Hierarchy.

Examining the Structure of a DOM.

Constructing a User-Friendly JTree from a DOM.

Creating and Manipulating a DOM.

Validating with XML Schema.

Further Information.

7. Extensible Stylesheet Language Transformations.

Introducing XSL, XSLT and XPath.

How XPath Works.

Generating XML from an Arbitrary Data Structure.

Transforming XML Data with XSLT.

Transforming from the Command Line with Xalan.

Concatenating Transformations with a Filter Chain.

Further Information.

8. Building Web Services with JAX-RPC.

Setting the Port.

Creating a Simple Web Service and Client with JAX-RPC.

Types Supported by JAX-RPC.

Web Service Clients.

Web Services Interoperability and JAX-RPC.

Further Information.

9. SOAP with Attachments API for Java.

Overview of SAAJ.


Code Examples.

Further Information.

10. Java API for XML Registries.

Implementing a JAXR Client .

Running the Client Examples.

Using JAXR Clients in J2EE Applications.

Further Information.

11. Java Servlet Technology.

What Is a Servlet?

The Example Servlets.

Servlet Life Cycle.

Sharing Information.

Initializing a Servlet.

Writing Service Methods.

Filtering Requests and Responses.

Invoking Other Web Resources.

Accessing the Web Context.

Maintaining Client State.

Finalizing a Servlet.

Further Information.

12. JavaServer Pages Technology.

What Is a JSP Page?

The Example JSP Pages.

The Life Cycle of a JSP Page.

Creating Static Content.

Creating Dynamic Content.

Expression Language.

JavaBeans Components.

Using Custom Tags.

Reusing Content in JSP Pages.

Transferring Control to Another Web Component.

Including an Applet.

Setting Properties for Groups of JSP Pages.

Further Information.

13. JavaServer Pages Documents.

The Example JSP Document.

Creating a JSP Document.

Identifying the JSP Document to the Container.

14. JavaServer Pages Standard Tag Library.

The Example JSP Pages.

Using JSTL.

Core Tag Library.

XML Tag Library.

Internationalization Tag Library.

SQL Tag Library.


Further Information.

15. Custom Tags in JSP Pages.

What Is a Custom Tag?

The Example JSP Pages.

Types of Tags.

Encapsulating Reusable Content Using Tag Files.

Tag Library Descriptors.

Programming Simple Tag Handlers.

16. Scripting in JSP Pages.

The Example JSP Pages.

Using Scripting.

Disabling Scripting.




Programming Tags That Accept Scripting Elements.

17. JavaServer Faces Technology.

JavaServer Faces Technology Benefits.

What Is a JavaServer Faces Application?

Framework Roles.

A Simple JavaServer Faces Application.

User Interface Component Model.

Navigation Model.

Backing Bean Management.

How the Pieces Fit Together.

The Life Cycle of a JavaServer Faces Page.

Further Information.

18. Using JavaServer Faces Technology in JSP Pages.

The Example JavaServer Faces Application.

Setting Up a Page.

Using the Core Tags.

Using the HTML Component Tags.

Using Localized Messages.

Using the Standard Converters.

Registering Listeners on Components.

Using the Standard Validators.

Binding Component Values and Instances to External Data Sources.

Referencing a Backing Bean Method.

Using Custom Objects.

19. Developing with JavaServer Faces Technology.

Writing Component Properties.

Performing Localization.

Creating a Custom Converter.

Implementing an Event Listener.

Creating a Custom Validator.

Writing Backing Bean Methods.

20. Creating Custom UI Components.

Determining Whether You Need a Custom Component or Renderer.

Understanding the Image Map Example.

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.

Delegating Rendering to a Renderer.

Handling Events for Custom Components.

21. Configuring JavaServer Faces Applications.

Application Configuration Resource File.

Configuring Beans.

Registering Messages.

Registering a Custom Validator.

Registering a Custom Converter.

Configuring Navigation Rules.

Registering a Custom Renderer with a Render Kit.

Registering a Custom Component.

Basic Requirements of a JavaServer Faces Application.

22. Internationalizing and Localizing Web Applications.

Java Platform Localization Classes.

Providing Localized Messages and Labels.

Date and Number Formatting.

Character Sets and Encodings.

Further Information.

23. Enterprise Beans.

What Is an Enterprise Bean?

What Is a Session Bean?

What Is an Entity Bean?

What Is a Message-Driven Bean?

Defining Client Access with Interfaces.

The Contents of an Enterprise Bean.

Naming Conventions for Enterprise Beans.

The Life Cycles of Enterprise Beans.

Further Information.

24. Getting Started with Enterprise Beans.

Creating the J2EE Application.

Creating the Enterprise Bean.

Creating the Application Client.

Creating the Web Client.

Mapping the Enterprise Bean References.

Specifying the Web Client's Context Root.

Deploying the J2EE Application.

Running the Application Client.

Running the Web Client.

Modifying the J2EE Application.

25. Session Bean Examples.

The CartBean Example.

A Web Service Example: HelloServiceBean.

Other Enterprise Bean Features.

Using the Timer Service.

Handling Exceptions.

26. Bean-Managed Persistence Examples.

The SavingsAccountBean Example.

Mapping Table Relationships for Bean-Managed Persistence.

Primary Keys for Bean-Managed Persistence.

deploytool Tips for Entity Beans with Bean-Managed Persistence.

27. Container-Managed Persistence Examples.

Overview of the RosterApp Application.

The PlayerBean Code.

Method Invocations in RosterApp.

Building and Running the RosterApp Example.

A Guided Tour of the RosterApp Settings.

Primary Keys for Container-Managed Persistence.

Advanced CMP Topics: The OrderApp Example.

deploytool Tips for Entity Beans with Container-Managed Persistence.

28. A Message-Driven Bean Example.

Example Application Overview.

The Application Client.

The Message-Driven Bean Class.

Deploying and Running SimpleMessageApp.

deploytool Tips for Message-Driven Beans.

deploytool Tips for Components That Send Messages.

29. Enterprise JavaBeans Query Language.


Simplified Syntax.

Example Queries.

Full Syntax.

EJB QL Restrictions.

30. Transactions.

What Is a Transaction?

Container-Managed Transactions.

Bean-Managed Transactions.

Summary of Transaction Options for Enterprise Beans.

Transaction Timeouts.

Isolation Levels.

Updating Multiple Databases.

Transactions in Web Components.

31. Resource Connections.

JNDI Naming.

DataSource Objects and Connection Pools.

Database Connections.

Mail Session Connections.

URL Connections.

Further Information.

32. Security.


Realms, Users, Groups, and Roles.

Web-Tier Security.

Understanding Login Authentication.

Installing and Configuring SSL Support.

XML and Web Services Security.

EJB-Tier Security.

Application Client-Tier Security.

EIS-Tier Security.

Propagating Security Identity.

What Is Java Authorization Contract for Containers?

Further Information.

34. The Java Message Service API.


Basic JMS API Concepts.

The JMS API Programming Model.

Writing Simple JMS Client Applications.

Creating Robust JMS Applications.

Using the JMS API in a J2EE Application.

Further Information.

34. J2EE Examples Using the JMS API.

A J2EE Application That Uses the JMS API with a Session Bean.

A J2EE Application That Uses the JMS API with an Entity Bean.

An Application Example That Consumes Messages from a Remote J2EE Server.

An Application Example That Deploys a Message-Driven Bean on Two J2EE Servers.

35. The Coffee Break Application.

Common Code.

JAX-RPC Coffee Supplier Service.

SAAJ Coffee Supplier Service.

Coffee Break Server.

JavaServer Faces Version of Coffee Break Server.

Building, Packaging, Deploying, and Running the Application.

36. The Duke's Bank Application.

Enterprise Beans.

Application Client.


Building, Packaging, Deploying, and Running the Application.

Running the Clients.

Appendix A: Java Encoding Schemes.

Further Information.

Appendix B: XML and Related Specs: Digesting the Alphabet Soup.

Basic Standards.

Schema Standards.

Linking and Presentation Standards.

Knowledge Standards.

Standards That Build on XML .


Appendix C: HTTP Overview.

HTTP Requests.

HTTP Responses.

Appendix D: J2EE Connector Architecture.

About Resource Adapters.

Resource Adapter Contracts.

Common Client Interface.

Further Information.


About the Authors.



Download the Foreword related to this title.


Download the Index file related to this title.


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020