JavaServer Pages, 3/e
暫譯: JavaServer Pages, 第三版

Hans Bergsten

  • 出版商: O'Reilly
  • 出版日期: 2004-01-06
  • 定價: $1,480
  • 售價: 5.0$740
  • 語言: 英文
  • 頁數: 664
  • 裝訂: Paperback
  • ISBN: 0596005636
  • ISBN-13: 9780596005634
  • 立即出貨 (庫存=1)

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

相關主題

商品描述

 

Summary

JavaServer Pages (JSP) has built a huge following since the release of JSP 1.0 in 1999, providing Enterprise Java developers with a flexible tool for the development of dynamic web sites and web applications. While new point releases over the years, along with the introduction of the JSP Standard Tag Library (JSTL), have incrementally improved the rough areas of the first version of the JSP specification, JSP 2.0 takes this technology to new heights.

JavaServer Pages, Third Edition, is completely revised and updated to cover the JSP 2.0 and JSTL 1.1 specifications. It includes detailed coverage of the Expression Language (EL) incorporated into JSP 2.0, the JSTL 1.1 tag libraries and the new function library, the new tag file format that enables custom tag library development without Java code, the simplified Java tag library API, improvements in the JSP XML syntax, and more. Further, it details setup of the Apache Tomcat server, JSP and JSTL syntax and features, error handling and debugging, authentication and personalization, database access, XML processing, and internationalization.

This book recognizes the different needs of the two groups of professionals who want to learn JSP: page authors interested in using JSP elements in web pages, and programmers concerned with learning the JSP API and using JSP effectively as a part of an enterprise application. If you're in the first group, you'll learn from the practical web application examples in the second part of the book. If you're in the latter group, you'll appreciate the detailed coverage of advanced topics in the third part, such as how to integrate servlets and JavaBeans components with JSP using the popular Apache Struts MVC framework, and how to develop custom tag libraries using the JSP API, with realistic examples that you can use as a springboard for your own libraries.

"Hans Bergsten, a JSP expert group veteran and one of our most active contributors, has thoroughly and accurately captured the new features of JSP 2.0 and JSTL 1.1 in a way that is well-organized and easy to understand. With excellent, to-the-point examples, this book is a 'must have' for any serious JSP 2.0 developer."
--Mark Roth, JSP 2.0 Specification Lead, Sun Microsystems, Inc.

Hans Bergsten is the founder of Gefion Software, a company focused on Java services and products based on J2EE technologies. Hans has been an active participant in the working groups for both the servlet and JSP specifications since their inception and contributes to other related JCP specifications, such as JSP Standard Tag Library (JSTL) and JavaServer Faces (JSF), and, as one of the initial members of the Apache Jakarta Project Management Committee, helped develop the Apache Tomcat reference implementation for the servlet and JSP specifications.

Table of Contents

Preface


Part I. JSP Application Basics

1. Introducing JavaServer Pages

     What Is JavaServer Pages?

     Why Use JSP?

     What You Need to Get Started

2. HTTP and Servlet Basics

     The HTTP Request/Response Model

     Servlets

3. JSP Overview

     The Problem with Servlets

     The Anatomy of a JSP Page

     JSP Processing

     JSP Application Design with MVC

4. Setting Up the JSP Environment

     Installing the Java Software Development Kit

     Installing the Tomcat Server

     Testing Tomcat

     Installing the Book Examples

     Example Web Application Overview


Part II. JSP Application Development

5. Generating Dynamic Content

     Creating a JSP Page

     Installing a JSP Page

     Running a JSP Page

     Using JSP Directive Elements

     Using Template Text

     Using JSP Action Elements

6. Using JavaBeans Components in JSP Pages

     What Is a Bean?

     Declaring a Bean in a JSP Page

     Reading Bean Properties

     Setting Bean Properties

7. Using Custom Tag Libraries and the JSP Standard Tag Library

     What Is a Custom Tag Library?

     Installing a Custom Tag Library

     Declaring a Custom Tag Library

     Using Actions from a Tag Library

8. Processing Input and Output

     Reading Request Parameter Values

     Validating User Input

     Formatting HTML Output

9. Error Handling and Debugging

     Dealing with Syntax Errors

     Debugging a JSP Application

     Dealing with Runtime Errors

10. Sharing Data Between JSP Pages, Requests, and Users

     Passing Control and Data Between Pages

     Sharing Session and Application Data

     Online Shopping

     Memory Usage Considerations

11. Developing Custom Tag Libraries as Tag Files

     Creating and Using a Tag File

     Accessing Attribute Values

     Processing the Action Body

     Processing Fragment Attributes

     Exposing Data to the Calling Page Through Variables

     Aborting the Page Processing

     Packaging Tag Files for Easy Reuse

12. Accessing a Database

     Accessing a Database from a JSP Page

     Validating Complex Input Without a Bean

     Using Transactions

     Application-Specific Database Actions

13. Authentication and Personalization

     Container-Provided Authentication

     Application-Controlled Authentication

     Other Security Concerns

14. Internationalization

     How Java Supports Internationalization and Localization
     Generating Localized Output

     A Brief History of Bits

     Handling Localized Input

15. Working with XML Data

     Generating an XML Response

     Transforming XML into HTML

     Transforming XML into a Device-Dependent Format

     Processing XML Data

16. Using Scripting Elements

     Using page Directive Scripting Attributes

     Implicit JSP Scripting Objects

     Using Scriptlets

     Using Expressions

     Using Declarations

     Mixing Action Elements and Scripting Elements

     Dealing with Scripting Syntax Errors

17. Bits and Pieces

     Buffering

     Including Page Segments

     Global Configuration Options

     Mixing Client-Side and Server-Side Code

     Precompiling JSP Pages

     Preventing Caching of JSP Pages

     Writing JSP Pages as XML Documents

     How URIs Are Interpreted


Part III. JSP in J2EE and JSP Component Development

18. Web Application Models

     The Java 2 Enterprise Edition Model

     The MVC Design Model

     Scalability

19. Combining JSP and Servlets

     Servlets, Filters, and Listeners

     Picking the Right Component Type for Each Task

     Initializing Shared Resources Using a Listener

     Access Control Using a Filter

     Centralized Request Processing Using a Servlet

     Using a Common JSP Error Page

20. Developing JavaBeans Components for JSP

     Beans as JSP Components

     JSP Bean Examples

     Unexpected <jsp:setProperty> Behavior

21. Developing Custom Tag Libraries Using Java

     Developing Simple Tag Handlers

     Developing Classic Tag Handlers

     Developing Tag Library Functions

     Creating the Tag Library Descriptor

     Packaging and Installing a Tag Library

22. Advanced Custom Tag Library Features

     Developing Cooperating Actions

     Validating Syntax

     Using a Listener in a Tag Library

     Dynamic Attribute Values and Types

23. Integrating Custom Code with JSTL

     Setting and Using Configuration Variables

     Integrating Custom Conditional Actions

     Integrating Custom Iteration Actions

     Integrating Custom I18N Actions

     Integrating Custom Database Actions

     Using JSTL Tag Library Validators

24. Database Access Strategies

     JDBC Basics

     Using Connections and Connection Pools

     Making a Connection Pool Available to Application Components

     Using a Generic Database Bean

     Developing Application-Specific Database Components


Part IV. Appendixes

A. JSP Elements Reference

B. JSTL Actions and API Reference

C. JSP Expression Language Reference

D. JSP API Reference

E. Book Example Custom Actions and API Reference

F. Web Application Structure and Deployment Descriptor Reference


Index

商品描述(中文翻譯)

摘要

JavaServer Pages (JSP) 自1999年發布JSP 1.0以來,已經建立了龐大的追隨者群體,為企業Java開發者提供了一個靈活的工具,用於開發動態網站和網頁應用程式。雖然隨著時間的推移,新版本的發布以及JSP標準標籤庫 (JSTL) 的引入逐步改善了JSP規範第一版的粗糙之處,但JSP 2.0將這項技術提升到了新的高度。

《JavaServer Pages》第三版已全面修訂和更新,以涵蓋JSP 2.0和JSTL 1.1規範。它詳細介紹了JSP 2.0中納入的表達式語言 (EL)、JSTL 1.1標籤庫和新的函數庫、新的標籤文件格式,該格式使得無需Java代碼即可開發自定義標籤庫、簡化的Java標籤庫API、JSP XML語法的改進等。此外,它還詳細說明了Apache Tomcat伺服器的設置、JSP和JSTL語法及特性、錯誤處理和調試、身份驗證和個性化、數據庫訪問、XML處理和國際化。

本書認識到希望學習JSP的兩類專業人士的不同需求:對使用JSP元素於網頁感興趣的頁面作者,以及希望學習JSP API並有效使用JSP作為企業應用程式一部分的程式設計師。如果您屬於第一組,您將從本書第二部分的實用網頁應用程式範例中學習。如果您屬於後者,您將欣賞第三部分中對進階主題的詳細介紹,例如如何使用流行的Apache Struts MVC框架將servlet和JavaBeans組件與JSP整合,以及如何使用JSP API開發自定義標籤庫,並提供可作為您自己庫的跳板的實際範例。

「Hans Bergsten,JSP專家小組的資深成員和我們最活躍的貢獻者之一,徹底而準確地捕捉了JSP 2.0和JSTL 1.1的新特性,並以組織良好且易於理解的方式呈現。這本書提供了優秀且切中要點的範例,是任何認真對待JSP 2.0開發者的必備之作。」
--Mark Roth,JSP 2.0規範負責人,Sun Microsystems, Inc.

Hans Bergsten是Gefion Software的創始人,該公司專注於基於J2EE技術的Java服務和產品。自servlet和JSP規範成立以來,Hans一直是工作小組的活躍參與者,並為其他相關的JCP規範(如JSP標準標籤庫 (JSTL) 和JavaServer Faces (JSF))做出貢獻,作為Apache Jakarta專案管理委員會的初始成員之一,幫助開發了Apache Tomcat的servlet和JSP規範的參考實現。

目錄

前言

第一部分:JSP應用程式基礎

1. 介紹JavaServer Pages
- 什麼是JavaServer Pages?
- 為什麼使用JSP?
- 開始所需的條件

2. HTTP和Servlet基礎
- HTTP請求/響應模型
- Servlets

3. JSP概述
- Servlets的問題
- JSP頁面的結構
- JSP處理
- 使用MVC進行JSP應用程式設計

4. 設置JSP環境
- 安裝Java軟體開發工具包
- 安裝Tomcat伺服器
- 測試Tomcat
- 安裝書中範例
- 範例網頁應用程式概述

第二部分:JSP應用程式開發

5. 生成動態內容
- 創建JSP頁面
- 安裝JSP頁面
- 運行JSP頁面
- 使用JSP指令元素
- 使用模板文本
- 使用JSP動作元素

6. 在JSP頁面中使用JavaBeans組件
- 什麼是Bean?
- 在JSP頁面中聲明Bean
- 讀取Bean屬性
- 設置Bean屬性

7. 使用自定義標籤庫和JSP標準標籤庫
- 什麼是自定義標籤庫?
- 安裝自定義標籤庫
- 聲明自定義標籤庫
- 使用標籤庫中的動作

8. 處理輸入和輸出
- 讀取請求參數值
- 驗證用戶輸入
- 格式化HTML輸出

9. 錯誤處理和調試
- 處理語法錯誤
- 調試JSP應用程式
- 處理運行時錯誤

10. 在JSP頁面、請求和用戶之間共享數據
- 在頁面之間傳遞控制和數據
- 共享會話和應用數據
- 在線購物
- 記憶體使用考量

11. 作為標籤文件開發自定義標籤庫
- 創建和使用標籤文件
- 訪問屬性值
- 處理動作主體
- 處理片段屬性
- 通過變數將數據暴露給調用頁面
- 中止頁面處理
- 將標籤文件打包以便於重用

12. 訪問數據庫
- 從JSP頁面訪問數據庫
- 在沒有Bean的情況下驗證複雜輸入
- 使用事務
- 應用特定的數據庫操作

13. 身份驗證和個性化
- 容器提供的身份驗證
- 應用控制的身份驗證
- 其他安全考量

14. 國際化
- Java如何支持國際化和本地化
- 生成本地化輸出
- 簡要的位元歷史
- 處理本地化輸入

15. 處理XML數據
- 生成XML響應
- 將XML轉換為HTML
- 將XML轉換為設備依賴格式
- 處理XML數據

16. 使用腳本元素
- 使用頁面指令腳本屬性
- 隱式JSP腳本對象
- 使用Scriptlets
- 使用表達式
- 使用聲明
- 混合動作元素和腳本元素
- 處理腳本語法錯誤

17. 雜項
- 緩衝
- 包含頁面片段
- 全局配置選項
- 混合客戶端和伺服器端代碼
- 預編譯JSP頁面
- 防止JSP頁面緩存
- 將JSP頁面寫為XML文檔
- URI的解釋方式

第三部分:JSP在J2EE和JSP組件開發中的應用

18. 網頁應用程式模型
- Java 2企業版模型
- MVC設計模型
- 可擴展性

19. 結合JSP和Servlet
- Servlets、過濾器和監聽器
- 為每個任務選擇合適的組件類型
- 使用監聽器初始化共享資源
- 使用過濾器進行訪問控制
- 使用Servlet進行集中請求處理
- 使用通用JSP錯誤頁面

20. 為JSP開發JavaBeans組件
- Beans作為JSP組件
- JSP Bean範例
- 意外的行為

21. 使用Java開發自定義標籤庫
- 開發簡單的標籤處理器
- 開發經典的標籤處理器
- 開發標籤庫函數
- 創建標籤庫描述符
- 打包和安裝標籤庫

22. 進階自定義標籤庫功能
- 開發協作動作
- 驗證語法
- 在標籤庫中使用監聽器
- 動態屬性值和類型

23. 將自定義代碼與JSTL整合
- 設置和使用配置變數
- 整合自定義條件動作
- 整合自定義迭代動作
- 整合自定義國際化動作
- 整合自定義數據庫動作
- 使用JSTL標籤庫驗證器

24. 數據庫訪問策略
- JDBC基礎
- 使用連接和連接池
- 使連接池可供應用組件使用
- 使用通用數據庫Bean
- 開發應用特定的數據庫組件

附錄

A. JSP元素參考

B. JSTL動作和API參考

C. JSP表達式語言參考

D. JSP API參考

E. 書中範例自定義動作和API參考

F. 網頁應用程式結構和部署描述符參考

索引