The Java EE 5 Tutorial / Edition 3

The Java EE 5 Tutorial / Edition 3

Pub. Date:

Multimedia Set - Rent for

Select a Purchase Option
  • purchase options

Temporarily Out of Stock Online


The Java EE 5 Tutorial / Edition 3

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

Product Details

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

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 JavaBeans™ Technology 1263

About the Authors 1265
Index 1267

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews