The Java EE 5 Tutorial, 3/e
暫譯: Java EE 5 教學手冊 (第三版)

Eric Jendrock, Jennifer Ball, Debbie Carson, Ian Evans, Scott Fordin, Kim Haase

  • 出版商: Addison Wesley
  • 出版日期: 2006-11-13
  • 售價: $2,540
  • 貴賓價: 9.5$2,413
  • 語言: 英文
  • 頁數: 1360
  • 裝訂: Paperback
  • ISBN: 0321490290
  • ISBN-13: 9780321490292
  • 相關分類: Java 程式語言
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Description

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

 

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

商品描述(中文翻譯)

《Java EE 5 教程》是對於編寫伺服器端 Java 應用程式的介紹。本書採取以任務為導向、以範例為驅動的方法,向您展示如何為 Java EE 5 平台構建應用程式。本書還描述了 NetBeans 5.5 提供的功能和特性。

這一版有什麼新內容?作者團隊已更新現有章節,以反映 JSP、EJB、Servlet 等的變更。此外,作者還新增了有關 Sun Java System Application Server 9 的章節,作為伺服器端技術的部署環境。網頁層技術章節涵蓋了用於開發 Java EE 5 或獨立網頁應用程式的展示層的組件。網路服務技術章節涵蓋了用於開發標準網路服務的 API。企業 JavaBeans (EJB) 技術章節涵蓋了用於開發 Java EE 5 應用程式商業邏輯的組件。持久性技術章節涵蓋了 Java 持久性 API,該 API 用於從 Java EE 應用程式訪問資料庫。平台服務章節涵蓋了所有 Java EE 5 組件技術所使用的系統服務。

目錄
第一部分:網頁層
第 1 章:概述
Java EE 應用程式模型
分散式多層應用程式
Java EE 容器
網路服務支援
Java EE 應用程式組裝與部署
打包應用程式
開發角色
Java EE 5 API
Sun Java System Application Server 平台版 9

第一部分:網頁層
第 2 章:開始使用網頁應用程式
網頁應用程式生命週期
網頁模組
配置網頁應用程式
Duke 的書店範例
從網頁應用程式訪問資料庫
進一步資訊

第 3 章:Java Servlet 技術
什麼是 Servlet?
範例 Servlet
Servlet 生命週期
共享資訊
初始化 Servlet
編寫服務方法
過濾請求和回應
調用其他網頁資源
訪問網頁上下文
維護客戶端狀態
終結 Servlet
進一步資訊

第 4 章:JavaServer Pages 技術
什麼是 JSP 頁面?
範例 JSP 頁面
JSP 頁面的生命週期
創建靜態內容
創建動態內容
統一表達式語言
JavaBeans 組件
使用自定義標籤
在 JSP 頁面中重用內容
將控制權轉移到其他網頁組件
包含小應用程式
為一組 JSP 頁面設置屬性
進一步資訊

第 5 章:JavaServer Pages 文件
範例 JSP 文件
創建 JSP 文件
向容器識別 JSP 文件

第 6 章:JavaServer Pages 標準標籤庫
範例 JSP 頁面
使用 JSTL
核心標籤庫
XML 標籤庫
國際化標籤庫
SQL 標籤庫
函數
進一步資訊

第 7 章:JSP 頁面中的自定義標籤
什麼是自定義標籤?
範例 JSP 頁面
標籤的類型
使用標籤文件封裝可重用內容
標籤庫描述符
編寫簡單標籤處理器

第 8 章:JSP 頁面中的腳本
範例 JSP 頁面
使用腳本
禁用腳本
聲明
腳本片段
表達式
編寫接受腳本元素的標籤

第 9 章:JavaServer Faces 技術
JavaServer Faces 技術的好處
什麼是 JavaServer Faces 應用程式?
一個簡單的 JavaServer Faces 應用程式
用戶界面組件模型
導航模型
後台 Bean
JavaServer Faces 頁面的生命週期
進一步資訊

第 10 章:在 JSP 頁面中使用 JavaServer Faces 技術
範例 JavaServer Faces 應用程式
設置頁面
使用核心標籤
使用 HTML 組件標籤向頁面添加 UI 組件
使用本地化數據
使用標準轉換器
在組件上註冊監聽器
使用標準驗證器
將組件值和實例綁定到外部數據源
將轉換器、監聽器和驗證器綁定到後台 Bean 屬性
引用後台 Bean 方法
使用自定義對象

第 11 章:使用 JavaServer Faces 技術進行開發
編寫 Bean 屬性
執行本地化
創建自定義轉換器
實現事件監聽器
創建自定義驗證器
編寫後台 Bean 方法
第 12 章:創建自定義 UI 組件
確定您是否需要自定義組件或渲染器
理解圖像地圖範例
創建自定義組件的步驟
創建自定義組件類
將渲染委派給渲染器
處理自定義組件的事件
創建組件標籤處理器
在標籤庫描述符中定義自定義組件標籤