Home > Store

Java? EE 5 Tutorial, The, 3rd Edition

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

Java? EE 5 Tutorial, The, 3rd Edition

Book

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

Description

  • Copyright 2007
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 1360
  • Edition: 3rd
  • Book
  • ISBN-10: 0-321-49029-0
  • ISBN-13: 978-0-321-49029-2

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

Sample Content

Online Sample Chapter

An Overview of JavaServer Faces Technology

Downloadable Sample Chapter

Download the sample chapter

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 389

Writing 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 JavaBeansTM Technology 1263

About the Authors 1265
Index 1267

Index

Download the Index from this book.

Updates

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.

Overview


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.

Surveys

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.

Newsletters

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.

Security


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

Children


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

Marketing


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.

Choice/Opt-out


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.

Links


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