BN.com Gift Guide

The Java EE 5 Tutorial / Edition 3

Multimedia Set (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 96%)
Other sellers (Multimedia Set)
  • All (13) from $1.99   
  • New (6) from $42.06   
  • Used (7) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$42.06
Seller since 2007

Feedback rating:

(23502)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
BRAND NEW

Ships from: Avenel, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
$42.16
Seller since 2008

Feedback rating:

(17728)

Condition: New
Brand New, Perfect Condition, Please allow 4-14 business days for delivery. 100% Money Back Guarantee, Over 1,000,000 customers served.

Ships from: Westminster, MD

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
$44.24
Seller since 2014

Feedback rating:

(0)

Condition: New
0321490290 Premium Publisher Direct Books are Like New or Brand New books direct from the publisher sometimes at a discount. Multiple copies are usually available. These books ... are not available for expedited shipping and may take up to 14 business days to receive. Read more Show Less

Ships from: Agoura Hills, CA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Express, 48 States
$46.45
Seller since 2014

Feedback rating:

(31)

Condition: New
PAPERBACK New 0321490290 Premium Publisher Direct Books are Like New or Brand New books direct from the publisher sometimes at a discount. Multiple copies are usually ... available. These books are not available for expedited shipping and may take up to 14 business days to receive. Read more Show Less

Ships from: Tarzana, CA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$69.68
Seller since 2014

Feedback rating:

(5)

Condition: New
New

Ships from: Idyllwild, CA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$74.71
Seller since 2010

Feedback rating:

(9)

Condition: New
11-3-06 other 3 BRAND NEW! ONLY Expedited orders are shipped with tracking number! *WE DO NOT SHIP TO PO BOX* Please allow up to 14 days delivery for order with standard ... shipping. SHIPPED FROM MULTIPLE LOCATIONS. Read more Show Less

Ships from: San Jose, CA

Usually ships in 1-2 business days

  • Canadian
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing All
Close
Sort by

Overview

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

Read More Show Less

Product Details

  • ISBN-13: 9780321490292
  • Publisher: Addison-Wesley
  • Publication date: 11/17/2006
  • Series: Java Series
  • Edition number: 3
  • Pages: 1360
  • Product dimensions: 7.40 (w) x 9.20 (h) x 2.00 (d)

Meet the Author

Eric Jendrock leads Sun's Java EE Tutorial and Java WSIT Tutorial teams.

Jennifer Ball has documented JavaServer Faces technology, the Java2D API, deploytool, and JAXB.

Debbie Carson documents the Java EE, Java SE, and Java WSIT platforms.

Ian Evans documents the Java EE and Java Web Services platforms, and edits Java EE platform specifications.

Scott Fordin has written numerous articles and Sun guidebooks on Java, XML, and web service technologies.

Kim Haase documents the Java EE platform and Java Web Services, including Java Message Service (JMS), Java API for XML Registries (JAXR), and the SAAJ.

Read More Show Less

Read an Excerpt

About This Tutorial

This tutorial is a guide to developing enterprise applications for the Java Platform, Enterprise Edition 5 (Java EE 5). Here we cover all the things you need to know to make the best use of this tutorial.Who Should Use This Tutorial

This tutorial is intended for programmers who are interested in developing and deploying applications on the Sun Java System Application Server Platform Edition 9.Prerequisites

Before proceeding with this tutorial, you should have a good knowledge of the Java programming language. A good way to get to that point is to work through The Java&38482; Tutorial, Fourth Edition, Sharon Zakhour et al. (Addison-Wesley, 2006). You should also be familiar with the relational database features described in JDBC API Tutorial and Reference, Third Edition, Maydene Fisher et al. (Addison-Wesley, 2003).How to Read This Tutorial

The Java EE 5 platform is quite large, and this tutorial reflects this. However, you don't have to digest everything in it at once. The tutorial has been divided into parts to help you navigate the content more easily.

This tutorial opens with an introductory chapter, which you should read before proceeding to any specific technology area. Chapter 1 covers the Java EE 5 platform architecture and APIs along with the Sun Java System Application Server Platform Edition 9.

When you have digested the basics, you can delve into one or more of the five main technology areas listed next. Because there are dependencies between some of the chapters, the following list contains a roadmap for navigating through the tutorial.

  • The web-tier technology chapters cover the componentsused in developing the presentation layer of a Java EE 5 or stand-alone web application:
    • Java Servlet
    • JavaServer Pages (JSP)
    • JavaServer Pages Standard Tag Library (JSTL)
    • JavaServer Faces
    • Web application internationalization and localization
  • The web services technology chapters cover the APIs used in developing standard web services:
    • The Java API for
    • The Java API for
    • The Streaming API for
    • The SOAP with Attachments API for Java (SAAJ)
    • The Java API for
  • The Enterprise JavaBeans (EJB) technology chapters cover the components used in developing the business logic of a application:
    • Session beans
    • Message-driven beans
  • The Persistence technology chapters cover the Java Persistence API, which is used for accessing databases from Java EE applications:
    • Introduction to the Java Persistence API
    • Persistence in the Web Tier
    • Persistence in the EJB Tier
    • The Java Persistence Query Language
  • The platform services chapters cover the system services used by all the Java EE 5 component technologies:
    • Transactions
    • Resource connections
    • Security
    • Java Message Service
    • The Connector architecture

After you have become familiar with some of the technology areas, you are ready to tackle the case studies, which tie together several of the technologies discussed in the tutorial. The Coffee Break Application describes an application that uses the web application and web services APIs. The Duke's Bank Application describes an application that employs web application technologies, enterprise beans, and the Java Persistence API.

Finally, the appendix contains information about Java encoding schemes that may be helpful to the Java EE 5 application developer.About the Examples

This section tells you everything you need to know to install, build, and run the examples.Required Software

The following software is required to run the examples.Tutorial Bundle

The tutorial example source is contained in the tutorial bundle. If you are viewing this online, you need to click on the Download link at the top of any page.

After you have installed the tutorial bundle, the example source code is in the INSTALL›/javaeetutorial5/examples/ directory, with subdirectories for each of the technologies discussed in the tutorial.Application Server

The Sun Java System Platform Application Server Platform Edition 9 is targeted as the build and runtime environment for the tutorial examples. To build, deploy, and run the examples, you need a copy of the Application Server and Java 2 Platform, Standard Edition 5.0 (J2SE 5.0). If you already have a copy of the J2SE SDK, you can download the Application Server from: http://java.sun.com/javaee/downloads/index.html

You can also download the Java EE 5 SDK—which contains the Application Server and the J2SE SDK—from the same site.Application Server Installation Tips

In the Admin configuration pane of the Application Server installer:

  • Select the Don't Prompt for Admin User Name radio button. This will save the user name and password so that you won't need to provide them when performing administrative operations with asadmin. You will still have to provide the user name and password to log in to the Admin Console.
  • Note the HTTP port at which the server is installed. This tutorial assumes that you are accepting the default port of 8080. If 8080 is in use during installation and the installer chooses another port or if you decide to change it yourself, you will need to update the common build properties file (described in the next section) and the configuration files for some of the tutorial examples to reflect the correct port.

In the Installation Options pane, check the Add Bin Directory to PATH checkbox so that Application Server scripts (asadmin, wsimport, wsgen, xjc, and schemagen) override other installations.NetBeans 5.5

The NetBeans integrated development environment (IDE) is a free, open-source IDE for developing Java applications, including enterprise applications. NetBeans 5.5 supports the Java EE 5 platform. You can build, package, deploy, and run the tutorial examples from within NetBeans 5.5, which you can download at http://www.netbeans.org/downloads/index.html. For information on creating enterprise applications in NetBeans 5.5, see http://www.netbeans.org/kb/55/index.html.Apache Ant

Ant is a Java technology-based build tool developed by the Apache Software Foundation (http://ant.apache.org), and is used to build, package, and deploy the tutorial examples. Ant is included with the Application Server. To use the ant command, add JAVAEE_HOME›/lib/ant/bin to your PATH environment variable.Registry Server

You need a registry server to run the examples discussed in Chapter 19. Instructions for obtaining and setting up a registry server are provided in Chapter 19.Building the Examples

The tutorial examples are distributed with a configuration file for either NetBeans 5.5 or Ant. Directions for building the examples are provided in each chapter. Either NetBeans 5.5 or Ant may be used to build, package, deploy, and run the examples.Building the Examples Using NetBeans 5.5

To run the tutorial examples in NetBeans 5.5, you must register your Application Server installation as a NetBeans Server Instance. Follow these instructions to register the Application Server in NetBeans 5.5.

  1. Select Tools→Server Manager to open the Server Manager dialog.
  2. Click Add Server.
  3. Under Server, select Sun Java System Application Server and click Next.
  4. Under Platform Location, enter the location of your Application Server installation.
  5. Select Register Local Default Domain and click Next.
  6. Under Admin Username and Admin Password, enter the admin name and password you specified while installing the Application Server.
  7. Click Finish.
Building the Examples on the Command-Line Using Ant

Build properties common to all the examples are specified in the build.properties file in the INSTALL›/javaeetutorial5/examples/bp-project/ directory. You must create this file before you can run the examples. We've included a sample file, build.properties.sample, that you should rename to build.properties and edit to reflect your environment. The tutorial examples use the Java BluePrints (http://java.sun.com/reference/blueprints/) build system and application layout structure.

To run the Ant scripts, you must set common build properties in the file INSTALL› /javaeetutorial5/examples/bp-project/build.properties as follows:


  • Set the javaee.home property to the location of your Application Server installation. The build process uses the javaee.home property to include the libraries in JAVAEE_HOME›/lib/ in the classpath. All examples that run on the Application Server include the Java EE library archive—JAVAEE_HOME›/lib/javaee.jar—in the build classpath. Some examples use additional libraries in JAVAEE_HOME›/lib/; the required libraries are enumerated in the individual technology chapters. JAVAEE_HOME refers to the directory where you have installed the Application Server.
    Note: On Windows, you must escape any backslashes in the javaee.home property with another backslash or use forward slashes as a path separator. So, if your Application Server installation is C:\Sun\AppServer, you must set javaee.home as follows:

    javaee.home = C:\\Sun\\AppServer

    or

    javaee.home=C:/Sun/AppServer
  • Set the javaee.tutorial.home property to the location of your tutorial. This property is used for Ant deployment and undeployment.
  • For example, on UNIX:

    javaee.tutorial.home=/home/username/javaeetutorial5

    On Windows:

    javaee.tutorial.home=C:/javaeetutorial5

    Do not install the tutorial to a location with spaces in the path.

  • If you did not use the default value (admin) for the admin user, set the admin.user property to the value you specified when you installed the Application Server.
  • If you did not use port 8080, set the domain.resources.port property to the value specified when you installed the Application Server.
  • Set the admin user's password in the admin-password.txt file in the INSTALL›/javaeetutorial5/examples/common/ directory to the value you specified when you installed the Application Server. The format of this file is AS_ADMIN_PASSWORD = password. For example:

    AS_ADMIN_PASSWORD = mypassword
Tutorial Example Directory Structure

To facilitate iterative development and keep application source separate from compiled files, the tutorial examples use the Java BluePrints application directory structure.

Each application module has the following structure:

  • build.

    : Ant build file

  • src/java: Java source files for the module
  • src/conf: configuration files for the module, with the exception of web applications
  • web: JSP and HTML pages, style sheets, tag files, and images
  • web/WEB-INF: configuration files for web applications
  • nbproject: NetBeans project files

Examples that have multiple application modules packaged into an enterprise application archive (or EAR) have submodule directories that use the following naming conventions:

  • EXAMPLE_NAME›-app-client: Application clients
  • EXAMPLE_NAME›-ejb: Enterprise bean JARs
  • EXAMPLE_NAME›-war: web applications

The Ant build files (build.

) distributed with the examples contain targets to create a build subdirectory and to copy and compile files into that directory; a dist subdirectory, which holds the packaged module file; and a client-jar directory, which holds the retrieved application client JAR. Further Information

This tutorial includes the basic information that you need to deploy applications on and administer the Application Server.

See the Sun Java™ System Application Server Platform Edition 9 Developer's Guide at http://docs.sun.com/doc/819-3659 for information about developer features of the Application Server.

See the Sun Java™ System Application Server Platform Edition 9 Administration Guide at http://docs.sun.com/doc/819-3658 for information about administering the Application Server.

For information about the Java DB database included with the Application Server see the Apache web site at http://db.apache.org/derby.Typographical Conventions

Typographical conventions used in this tutorial are listed below.

  • italic: Emphasis, titles, first occurrence of terms
  • monospace: URLs, code examples, file names, path names, tool names, application names, programming language keywords, tag, interface, class, method, and field names, properties
  • italic monospace: Variables in code, file paths, and URLs
  • italic monospace›: User-selected file path components

Menu selections indicated with the right-arrow character →, for example, First→ Second, should be interpreted as: select the First menu, then choose Second from the First submenu. Feedback

To send comments, broken link reports, errors, suggestions, and questions about this tutorial to the tutorial team, please use the feedback form at http://java.sun.com/javaee/5/docs/tutorial/information/sendusmail.html.

Read More Show Less

Table of Contents

About This Tutorial xxxi

Who Should Use This Tutorial xxxi Prerequisites;   xxxi How to Read This Tutorial xxxi About the Examples xxxiv Further Information xxxviii Typographical Conventions xxxix Acknowledgments xxxix Feedback xli

Chapter 1: Overview 1

Java EE Application Model 2
Distributed Multitiered Applications 3
Java EE Containers 8
Web Services Support 11
Java EE Application Assembly and Deployment 13
Packaging Applications 13
Development Roles 15
Java EE 5 APIs 18
Sun Java System Application Server Platform Edition 9 26

Part One: The Web Tier 31

Chapter 2: Getting Started with Web Applications 33

Web Application Life Cycle 36
Web Modules 38
Configuring Web Applications 46
Duke's Bookstore Examples 55
Accessing Databases from Web Applications 55
Further Information 57

Chapter 3: Java Servlet Technology 59

What Is a Servlet? 59
The Example Servlets 60
Servlet Life Cycle 63
Sharing Information 66
Initializing a Servlet 70
Writing Service Methods 71
Filtering Requests and Responses 77
Invoking Other Web Resources 84
Accessing the Web Context 88
Maintaining Client State 89
Finalizing a Servlet 92
Further Information 95

Chapter 4: JavaServer Pages Technology 97

What Is a JSP Page? 97
The Example JSP Pages 101
The Life Cycle of a JSP Page 107
Creating Static Content 110
Creating Dynamic Content 111
Unified Expression Language 113
JavaBeans Components 136
Using Custom Tags 141
Reusing Content in JSP Pages 145
Transferring Control to Another Web Component 146
Including an Applet 147
Setting Properties for Groups of JSP Pages 149
Further Information 154

Chapter 5: JavaServer Pages Documents 155

The Example JSP Document 156
Creating a JSP Document 158
Identifying the JSP Document to the Container 173

Chapter 6: JavaServer Pages Standard Tag Library 175

The Example JSP Pages 176
Using JSTL 177
Core Tag Library 180
XML Tag Library 188
Internationalization Tag Library 192
SQL Tag Library 195
Functions 199
Further Information 201

Chapter 7: Custom Tags in JSP Pages 203

What Is a Custom Tag? 204
The Example JSP Pages 204
Types of Tags 207
Encapsulating Reusable Content Using Tag Files 212
Tag Library Descriptors 229
Programming Simple Tag Handlers 240

Chapter 8: Scripting in JSP Pages 261

The Example JSP Pages 262
Using Scripting 263
Disabling Scripting 264
Declarations 264
Scriptlets 265
Expressions 266
Programming Tags That Accept Scripting Elements 267

Chapter 9: JavaServer Faces Technology 275

JavaServer Faces Technology Benefits 276
What Is a JavaServer Faces Application? 277
A Simple JavaServer Faces Application 278
User Interface Component Model 291
Navigation Model 302
Backing Beans 304
The Life Cycle of a JavaServer Faces Page 309
Further Information 315

Chapter 10: Using JavaServer Faces Technology in JSP Pages 317

The Example JavaServer Faces Application 318
Setting Up a Page 321
Using the Core Tags 324
Adding UI Components to a Page Using the HTML Component Tags 326
Using Localized Data 355
Using the Standard Converters 359
Registering Listeners on Components 366
Using the Standard Validators 369
Binding Component Values and Instances to External Data Sources 371
Binding Converters, Listeners, and Validators to Backing Bean Properties 378
Referencing a Backing Bean Method 379
Using Custom Objects 383

Chapter 11: Developing with JavaServer Faces

Technology 389Writing Bean Properties 390
Performing Localization 402
Creating a Custom Converter 405
Implementing an Event Listener 408
Creating a Custom Validator 411
Writing Backing Bean Methods 418
Chapter 12: Creating Custom UI Components 425
Determining Whether You Need a Custom Component or Renderer 426
Understanding the Image Map Example 429
Steps for Creating a Custom Component 436
Creating Custom Component Classes 437
Delegating Rendering to a Renderer 446
Handling Events for Custom Components 449
Creating the Component Tag Handler 450
Defining the Custom Component Tag in a Tag Library Descriptor 455

Chapter 13: Configuring JavaServer Faces Applications 457

Application Configuration Resource File 458
Configuring Beans 459
Registering Custom Error Messages 470
Registering Custom Localized Static Text 471
Registering a Custom Validator 472
Registering a Custom Converter 473
Configuring Navigation Rules 474
Registering a Custom Renderer with a Render Kit 478
Registering a Custom Component 480
Basic Requirements of a JavaServer Faces Application 481

Chapter 14: Internationalizing and Localizing Web Applications 493

Java Platform Localization Classes 493
Providing Localized Messages and Labels 494
Date and Number Formatting 498
Character Sets and Encodings 499
Further Information 503

Part Two: Web Services 505

Chapter 15: Building Web Services with JAX-WS 507

Setting the Port 508
Creating a Simple Web Service and Client with JAX-WS 508
Types Supported by JAX-WS 516
Web Services Interoperability and JAX-WS 516
Further Information 517

Chapter 16: Binding between XML Schema and Java Classes 519

JAXB Architecture 520
Representing XML Content 522
Binding XML Schemas 523
Customizing JAXB Bindings 526
Examples 533
Basic Examples 545
Customizing JAXB Bindings 549
Java-to-Schema Examples 575
Further Information 589

Chapter 17: Streaming API for XML 591

Why StAX? 591
StAX API 595
Using StAX 602
Sun's Streaming XML Parser Implementation 611
Example Code 612
Further Information 631

Chapter 18: SOAP with Attachments API for Java 633

Overview of SAAJ 634
Tutorial 639
Code Examples 667
Further Information 692

Chapter 19: Java API for XML Registries 693

Overview of JAXR 693
Implementing a JAXR Client 696
Running the Client Examples 720
Using JAXR Clients in Java EE Applications 733
Further Information 739

Part Three: Enterprise Beans 741

Chapter 20: Enterprise Beans 743

What Is an Enterprise Bean? 743
What Is a Session Bean? 745
What Is a Message-Driven Bean? 747
Defining Client Access with Interfaces 749
The Contents of an Enterprise Bean 754
Naming Conventions for Enterprise Beans 755
The Life Cycles of Enterprise Beans 755
Further Information 758

Chapter 21: Getting Started with Enterprise Beans 759

Creating the Enterprise Bean 760
Creating the Application Client 763
Creating the Web Client 765
Deploying the Java EE Application 767
Running the Application Client 768
Running the Web Client 769
Modifying the Java EE Application 770

Chapter 22: Session Bean Examples 771

The cart Example 771
A Web Service Example: helloservice 780
Using the Timer Service 783
Handling Exceptions 789

Chapter 23: A Message-Driven Bean Example 791

Example Application Overview 791
The Application Client 792
The Message-Driven Bean Class 793
Packaging, Deploying, and Running the SimpleMessage Example 795
Creating Deployment Descriptors for Message-Driven Beans 798

Part Four: Persistence 801

Chapter 24: Introduction to the Java Persistence API 803

Entities 803
Managing Entities 816

Chapter 25: Persistence in the Web Tier 825

Accessing Databases from Web Applications 825

Chapter 26: Persistence in the EJB Tier 835

The order Application 835
The roster Application 853

Chapter 27: The Java Persistence Query Language 861

Terminology 862
Simplified Syntax 862
Example Queries 863
Full Syntax 870

Part Five: Services 897

Chapter 28: Introduction to Security in Java EE 899

Overview 900
Security Implementation Mechanisms 906
Securing Containers 910
Securing the Application Server 913
Working with Realms, Users, Groups, and Roles 914
Establishing a Secure Connection Using SSL 922
Further Information 934

Chapter 29: Securing Java EE Applications 937

Securing Enterprise Beans 938
Enterprise Bean Example Applications 963
Securing Application Clients 978
Securing EIS Applications 980
Example Applications in the Application Server 984
Further Information 984

Chapter 30: Securing Web Applications 987

Overview 988
Working with Security Roles 989
Checking Caller Identity Programmatically 994
Defining Security Requirements for Web Applications 998
Examples: Securing Web Applications 1018
Further Information 1049

Chapter 31: The Java Message Service API 1051

Overview 1051
Basic JMS API Concepts 1055
The JMS API Programming Model 1059
Writing Simple JMS Client Applications 1071
Creating Robust JMS Applications 1098
Using the JMS API in a Java EE Application 1119
Further Information 1127

Chapter 32: Java EE Examples Using the JMS API 1129

A Java EE Application That Uses the JMS API with a Session Bean 1130
A Java EE Application That Uses the JMS API with an Entity 1136
An Application Example That Consumes Messages from a Remote Server 1146
An Application Example That Deploys a Message-Driven Bean on Two Servers 1153

Chapter 33: Transactions 1165

What Is a Transaction? 1165
Container-Managed Transactions 1166
Bean-Managed Transactions 1173
Transaction Timeouts 1174
Updating Multiple Databases 1175
Transactions in Web Components 1177

Chapter 34: Resource Connections 1179

Resources and JNDI Naming 1179
DataSource Objects and Connection Pools 1181
Resource Injection 1182
The confirmer Example Application 1186
Further Information 1190

Chapter 35: Connector Architecture 1191

About Resource Adapters 1191
Resource Adapter Contracts 1193
Common Client Interface 1196
Further Information 1197

Part Six: Case Studies 1199

Chapter 36: The Coffee Break Application 1201

Common Code 1202
JAX-WS Coffee Supplier Service 1202
SAAJ Coffee Supplier Service 1204
Coffee Break Server 1219
Building, Packaging, Deploying, and Running the Application 1226

Chapter 37: The Duke's Bank Application 1233

Enterprise Beans 1234
Application Client 1240
Web Client 1243
Building, Packaging, Deploying, and Running the Application 1253

Appendix A: Java Encoding Schemes 1259

Further Information 1260

Appendix B: Preparation for Java EE Certification Exams 1261

CX-310-081: Sun Certified Web Component Developer 1262
SL-351: Business Component Development with Enterprise JavaBeans™ Technology 1263

About the Authors 1265
Index 1267

Read More Show Less

Preface

About This Tutorial

This tutorial is a guide to developing enterprise applications for the Java Platform, Enterprise Edition 5 (Java EE 5). Here we cover all the things you need to know to make the best use of this tutorial.

Who Should Use This Tutorial

This tutorial is intended for programmers who are interested in developing and deploying applications on the Sun Java System Application Server Platform Edition 9.

Prerequisites

Before proceeding with this tutorial, you should have a good knowledge of the Java programming language. A good way to get to that point is to work through The Java&38482; Tutorial, Fourth Edition, Sharon Zakhour et al. (Addison-Wesley, 2006). You should also be familiar with the relational database features described in JDBC API Tutorial and Reference, Third Edition, Maydene Fisher et al. (Addison-Wesley, 2003).

How to Read This Tutorial

The Java EE 5 platform is quite large, and this tutorial reflects this. However, you don't have to digest everything in it at once. The tutorial has been divided into parts to help you navigate the content more easily.

This tutorial opens with an introductory chapter, which you should read before proceeding to any specific technology area. Chapter 1 covers the Java EE 5 platform architecture and APIs along with the Sun Java System Application Server Platform Edition 9.

When you have digested the basics, you can delve into one or more of the five main technology areas listed next. Because there are dependencies between some of the chapters, the following list contains a roadmap for navigating through the tutorial.

  • The web-tier technology chapters cover the components used in developing the presentation layer of a Java EE 5 or stand-alone web application:
  • Java Servlet
  • JavaServer Pages (JSP)
  • JavaServer Pages Standard Tag Library (JSTL)
  • JavaServer Faces
  • Web application internationalization and localization
  • The web services technology chapters cover the APIs used in developing standard web services:
  • The Java API for XML-based Web Services (JAX-WS)
  • The Java API for XML Binding (JAXB)
  • The Streaming API for XML (StAX)
  • The SOAP with Attachments API for Java (SAAJ)
  • The Java API for XML Registries (JAXR)
  • The Enterprise JavaBeans (EJB) technology chapters cover the components used in developing the business logic of a application:
  • Session beans
  • Message-driven beans
  • The Persistence technology chapters cover the Java Persistence API, which is used for accessing databases from Java EE applications:
  • Introduction to the Java Persistence API
  • Persistence in the Web Tier
  • Persistence in the EJB Tier
  • The Java Persistence Query Language
  • The platform services chapters cover the system services used by all the Java EE 5 component technologies:
  • Transactions
  • Resource connections
  • Security
  • Java Message Service
  • The Connector architecture

After you have become familiar with some of the technology areas, you are ready to tackle the case studies, which tie together several of the technologies discussed in the tutorial. The Coffee Break Application describes an application that uses the web application and web services APIs. The Duke's Bank Application describes an application that employs web application technologies, enterprise beans, and the Java Persistence API.

Finally, the appendix contains information about Java encoding schemes that may be helpful to the Java EE 5 application developer.

About the Examples

This section tells you everything you need to know to install, build, and run the examples.

Required Software

The following software is required to run the examples.

Tutorial Bundle

The tutorial example source is contained in the tutorial bundle. If you are viewing this online, you need to click on the Download link at the top of any page.

After you have installed the tutorial bundle, the example source code is in the INSTALL›/javaeetutorial5/examples/ directory, with subdirectories for each of the technologies discussed in the tutorial.

Application Server

The Sun Java System Platform Application Server Platform Edition 9 is targeted as the build and runtime environment for the tutorial examples. To build, deploy, and run the examples, you need a copy of the Application Server and Java 2 Platform, Standard Edition 5.0 (J2SE 5.0). If you already have a copy of the J2SE SDK, you can download the Application Server from: http://java.sun.com/javaee/downloads/index.html

You can also download the Java EE 5 SDK--which contains the Application Server and the J2SE SDK--from the same site.

Application Server Installation Tips

In the Admin configuration pane of the Application Server installer:

  • Select the Don't Prompt for Admin User Name radio button. This will save the user name and password so that you won't need to provide them when performing administrative operations with asadmin. You will still have to provide the user name and password to log in to the Admin Console.
  • Note the HTTP port at which the server is installed. This tutorial assumes that you are accepting the default port of 8080. If 8080 is in use during installation and the installer chooses another port or if you decide to change it yourself, you will need to update the common build properties file (described in the next section) and the configuration files for some of the tutorial examples to reflect the correct port.

In the Installation Options pane, check the Add Bin Directory to PATH checkbox so that Application Server scripts (asadmin, wsimport, wsgen, xjc, and schemagen) override other installations.

NetBeans 5.5

The NetBeans integrated development environment (IDE) is a free, open-source IDE for developing Java applications, including enterprise applications. NetBeans 5.5 supports the Java EE 5 platform. You can build, package, deploy, and run the tutorial examples from within NetBeans 5.5, which you can download at http://www.netbeans.org/downloads/index.html. For information on creating enterprise applications in NetBeans 5.5, see http://www.netbeans.org/kb/55/index.html.

Apache Ant

Ant is a Java technology-based build tool developed by the Apache Software Foundation (http://ant.apache.org), and is used to build, package, and deploy the tutorial examples. Ant is included with the Application Server. To use the ant command, add JAVAEE_HOME›/lib/ant/bin to your PATH environment variable.

Registry Server

You need a registry server to run the examples discussed in Chapter 19. Instructions for obtaining and setting up a registry server are provided in Chapter 19.

Building the Examples

The tutorial examples are distributed with a configuration file for either NetBeans 5.5 or Ant. Directions for building the examples are provided in each chapter. Either NetBeans 5.5 or Ant may be used to build, package, deploy, and run the examples.

Building the Examples Using NetBeans 5.5

To run the tutorial examples in NetBeans 5.5, you must register your Application Server installation as a NetBeans Server Instance. Follow these instructions to register the Application Server in NetBeans 5.5.

  1. Select Tools→Server Manager to open the Server Manager dialog.
  2. Click Add Server.
  3. Under Server, select Sun Java System Application Server and click Next.
  4. Under Platform Location, enter the location of your Application Server installation.
  5. Select Register Local Default Domain and click Next.
  6. Under Admin Username and Admin Password, enter the admin name and password you specified while installing the Application Server.
  7. Click Finish.

Building the Examples on the Command-Line Using Ant

Build properties common to all the examples are specified in the build.properties file in the INSTALL›/javaeetutorial5/examples/bp-project/ directory. You must create this file before you can run the examples. We've included a sample file, build.properties.sample, that you should rename to build.properties and edit to reflect your environment. The tutorial examples use the Java BluePrints (http://java.sun.com/reference/blueprints/) build system and application layout structure.

To run the Ant scripts, you must set common build properties in the file INSTALL› /javaeetutorial5/examples/bp-project/build.properties as follows:

  • Set the javaee.home property to the location of your Application Server installation. The build process uses the javaee.home property to include the libraries in JAVAEE_HOME›/lib/ in the classpath. All examples that run on the Application Server include the Java EE library archive--JAVAEE_HOME›/lib/javaee.jar--in the build classpath. Some examples use additional libraries in JAVAEE_HOME›/lib/; the required libraries are enumerated in the individual technology chapters. JAVAEE_HOME refers to the directory where you have installed the Application Server.
    Note: On Windows, you must escape any backslashes in the javaee.home property with another backslash or use forward slashes as a path separator. So, if your Application Server installation is C:\Sun\AppServer, you must set javaee.home as follows:
    javaee.home = C:\\Sun\\AppServer
    or
    javaee.home=C:/Sun/AppServer
  • Set the javaee.tutorial.home property to the location of your tutorial. This property is used for Ant deployment and undeployment.
  • For example, on UNIX:

    javaee.tutorial.home=/home/username/javaeetutorial5

    On Windows:

    javaee.tutorial.home=C:/javaeetutorial5

  • Do not install the tutorial to a location with spaces in the path.

  • If you did not use the default value (admin) for the admin user, set the admin.user property to the value you specified when you installed the Application Server.
  • If you did not use port 8080, set the domain.resources.port property to the value specified when you installed the Application Server.
  • Set the admin user's password in the admin-password.txt file in the INSTALL›/javaeetutorial5/examples/common/ directory to the value you specified when you installed the Application Server. The format of this file is AS_ADMIN_PASSWORD = password. For example:

    AS_ADMIN_PASSWORD = mypassword

Tutorial Example Directory Structure

To facilitate iterative development and keep application source separate from compiled files, the tutorial examples use the Java BluePrints application directory structure.

Each application module has the following structure:

  • build.xml: Ant build file
  • src/java: Java source files for the module
  • src/conf: configuration files for the module, with the exception of web applications
  • web: JSP and HTML pages, style sheets, tag files, and images
  • web/WEB-INF: configuration files for web applications
  • nbproject: NetBeans project files

Examples that have multiple application modules packaged into an enterprise application archive (or EAR) have submodule directories that use the following naming conventions:

  • EXAMPLE_NAME›-app-client: Application clients
  • EXAMPLE_NAME›-ejb: Enterprise bean JARs
  • EXAMPLE_NAME›-war: web applications

The Ant build files (build.xml) distributed with the examples contain targets to create a build subdirectory and to copy and compile files into that directory; a dist subdirectory, which holds the packaged module file; and a client-jar directory, which holds the retrieved application client JAR.

Further Information

This tutorial includes the basic information that you need to deploy applications on and administer the Application Server.

See the Sun Java™ System Application Server Platform Edition 9 Developer's Guide at http://docs.sun.com/doc/819-3659 for information about developer features of the Application Server.

See the Sun Java™ System Application Server Platform Edition 9 Administration Guide at http://docs.sun.com/doc/819-3658 for information about administering the Application Server.

For information about the Java DB database included with the Application Server see the Apache web site at http://db.apache.org/derby.

Typographical Conventions

Typographical conventions used in this tutorial are listed below.

  • italic: Emphasis, titles, first occurrence of terms
  • monospace: URLs, code examples, file names, path names, tool names, application names, programming language keywords, tag, interface, class, method, and field names, properties
  • italic monospace: Variables in code, file paths, and URLs
  • italic monospace›: User-selected file path components

Menu selections indicated with the right-arrow character →, for example, First→ Second, should be interpreted as: select the First menu, then choose Second from the First submenu.

Feedback

To send comments, broken link reports, errors, suggestions, and questions about this tutorial to the tutorial team, please use the feedback form at http://java.sun.com/javaee/5/docs/tutorial/information/sendusmail.html.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)