Jakarta Struts Cookbook
暫譯: Jakarta Struts 食譜

Bill Siggelkow

  • 出版商: O'Reilly
  • 出版日期: 2005-03-05
  • 售價: $1,730
  • 貴賓價: 9.5$1,644
  • 語言: 英文
  • 頁數: 528
  • 裝訂: Paperback
  • ISBN: 059600771X
  • ISBN-13: 9780596007713
  • 已過版

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

相關主題

商品描述

Description:

The Jakarta Struts Framework is a popular open source platform for building web applications from top to bottom with Java. While this popularity has led to a wealth of online and in-print documentation, developers still find themselves faced with a number of common tasks that are not clearly and succinctly explained.

In these situations, programmers can now turn to the Jakarta Struts Cookbook an amazing collection of code solutions to common--and uncommon--problems encountered when working with the Struts Framework. Among many other recipes, this book explains how to:

  • display data in complex HTML tables
  • use JSP, the JSTL, and JavaScript in your user interface
  • define static and dynamic action forms
  • validate data and respond to errors
  • use Logging, Validation, and Exception Handling
  • integrate Struts with persistence frameworks like Hibernate and iBATIS


This look-up reference is just what today's time-pressed developers need. With solutions to real-world problems just a few page flips away, information is instantly available. And while the book's solutions focus on getting to the point, each recipe's discussion section imparts valuable concept and insight from a Struts veteran.

The Jakarta Struts Cookbook is perfect for independent developers, large development teams, and everyone in between who wishes to use the Struts Framework to its fullest potential. Plus, it s completely up-to-date with the latest versions of Framework, so readers can be sure the information is viable.

 

Table of Contents:

Preface

1. Getting Started: Enabling Struts Development

      1.1 Downloading Struts  

      1.2 Deploying the Struts Example Application  

      1.3 Migrating from Struts 1.0 to Struts 1.1  

      1.4 Upgrading from Struts 1.1 to Struts 1.2  

      1.5 Converting JSP Applications to Struts  

      1.6 Managing Struts Configuration Files  

      1.7 Using Ant to Build and Deploy  

      1.8 Generating Struts Configuration Files Using XDoclet  

2. Configuring Struts Applications

      2.1 Using Plug-ins for Application Initialization  

      2.2 Eliminating Tag Library Declarations  

      2.3 Using Constants on JSPs  

      2.4 Using Multiple Struts Configuration Files  

      2.5 Factoring Your Application into Modules  

      2.6 Using Multiple Resource Bundles  

      2.7 Accessing Message Resources from a Database  

      2.8 Selectively Disabling Actions  

3. User Interface

      3.1 Using JSTL  

      3.2 Using the Struts-EL Tags  

      3.3 Displaying Indexed Properties  

      3.4 Using Indexed Properties on Forms  

      3.5 Using Indexed Properties in a JSTL Loop  

      3.6 Submitting a Form from an Image   

      3.7 Generating JavaScript on the Fly  

      3.8 Dynamically Changing Select Options Using JavaScript
      3.9 Generating Dynamic Select List Options  

      3.10 Filtering Text Input  

      3.11 Generating a Set of Related Radio Buttons  

      3.12 Handling Unchecked Checkboxes  

      3.13 Handling Date Input Fields  

      3.14 Setting Tab Order  

      3.15 Generating URLs  

      3.16 Adding Request Parameters to a Link  

      3.17 Using Frames  

      3.18 Defeating Browser Caching  

4. Tables, Sorting, and Grouping

      4.1 Creating a Horizontal Bar Chart  

      4.2 Creating a Vertical Bar Chart  

      4.3  Alternating Table Row Colors  

      4.4 Sorting HTML Tables  

      4.5 Paging Tables  

      4.6 Using the Display Tag Library  

5. Processing Forms

      5.1 Creating Dynamic Action Forms  

      5.2 Setting DynaActionForm Initial Values  

      5.3 Using a List-Backed Form Property  

      5.4 Using a Map-Backed Form Property  

      5.5 Lazy Dynamic Action Forms  

      5.6 Populating Value Objects from ActionForms  

      5.7 Automatically Creating ActionForms  

6. Leveraging Actions

      6.1 Creating a Base Action  

      6.2 Relaying Actions  

      6.3 Returning the HTTP Response  

      6.4 Writing Thread-Safe Actions  

      6.5 Forwarding Requests  

      6.6 Including the Response from a Servlet or JSP  

      6.7 Changing the Current Module  

      6.8 Managing Related Operations from a Central Action  

      6.9 Submitting a Form from Localized Form Controls  

      6.10 Dispatching to Related Operations with Action Mappings  

7. Execution Control

      7.1 Performing Tasks at Application Startup  

      7.2 Tracking Client Sessions  

      7.3 Monitoring User Logins  

      7.4 Forwarding Users to Alternate Destinations  

      7.5 Forwarding Users to a Module  

      7.6 Creating a Wizard-Style Page Flow  

      7.7 Determining the Action Based on User Input  

      7.8 Using Wildcards in Action Paths  

      7.9 Preventing Double Form Submissions  

      7.10 Allowing Users to Upload Files  

      7.11 Displaying a File from the Server   

8. Input Validation

      8.1 Reusing Validator Attribute Values  

      8.2 Validating Using Regular Expressions  

      8.3 Validating Dependent Fields in Struts 1.1  

      8.4 Validating Dependent Fields in Struts 1.2  

      8.5 Validating an Indexed Property  

      8.6 Validating Dates  

      8.7 Validating Field Equality with a Custom Validator  

      8.8 Validating Field Equality in Struts 1.2   

      8.9 Validating Two or More Choices  

      8.10 Adding a Custom Validation to a Validator Form  

      8.11 Validating a Wizard Form  

      8.12 Localizing Validation Rules  

9. Exception and Error Handling

      9.1 Simplifying Exception Processing in an Action  

      9.2 Custom Processing for Declared Exceptions  

      9.3 Using Exception Error Codes  

      9.4 Using a Global Error Page  

      9.5 Reporting Errors and Messages from an Action  

      9.6 Formatting Error Messages  

10. Connecting to the Data

      10.1 Accessing JDBC Data Sources from an Action  

      10.2 Displaying Relational Data  

      10.3 Mapping SQL Data to Java Objects  

      10.4 Integrating Struts with Hibernate  

      10.5 Decoupling Your Application from External Services   

      10.6 Integrating Spring with Struts  

      10.7 Loading XML Data into Your Application   

      10.8 Refreshing Application Data  

11. Security

      11.1 Securing Actions Using a Base Action  

      11.2 Checking for User Login on Any Struts Request  

      11.3 Securing a JSP Page  

      11.4 Restricting Actions by Role   

      11.5 Implementing "Remember Me" Logins  

      11.6 Ensuring Security Across Your Entire Application  

      11.7 Allowing a User to Log in Automatically  

      11.8 Limiting Access for Specific URLs by Role  

      11.9 Letting the Container Manage Security  

      11.10 Mixing Application-Managed and Container-Managed Security  

      11.11 Configuring Actions to Require SSL  

      11.12 Limiting the Size of Uploaded Files  

12. Internationalization

      12.1 Detecting Browser Language Settings  

      12.2 Sharing Message Resources with JSTL  

      12.3 Using an Application-Wide Locale  

      12.4 Changing Locale on the Fly  

      12.5 Creating Localized Messages from an Action  

      12.6 Displaying Locale-Specific Text  

      12.7 Displaying Locale-Specific Images  

      12.8 Supporting Character Sets  

      12.9 Localizing Look and Feel  

13. Testing and Debugging

      13.1 Deploying an Application Automatically  

      13.2 Configuring Struts Logging  

      13.3 Adding Logging to Your Own Classes  

      13.4 Enabling Remote Debugging  

      13.5 Troubleshooting JSP Pages  

      13.6 Testing Your Actions with Mock Objects  

      13.7 Testing Your Actions in the Container  

      13.8 Testing Application Functionality  

14. Tiles and Other Presentation Approaches

      14.1 Reusing a Common Page Layout with Tiles  

      14.2 Extending Tile Definitions  

      14.3 Displaying Tiles Using a Struts Forward  

      14.4 Creating Tabbed Panes  

      14.5 Using Tiles for I18N   

      14.6 Using Tiles in a Modular Application  

      14.7 Reusing a Common Page Layout with SiteMesh  

      14.8 Integrating JavaServer Faces with Struts  

      14.9 Integrating Struts and Velocity  

      14.10 Integrating Struts and XSLT  

Index

商品描述(中文翻譯)

**描述:**
Jakarta Struts 框架是一個流行的開源平台,用於從頭到尾使用 Java 建立網頁應用程式。儘管這種受歡迎程度導致了大量的線上和印刷文檔,但開發人員仍然面臨許多常見任務,這些任務並未得到清晰且簡潔的解釋。

在這些情況下,程式設計師現在可以參考《Jakarta Struts Cookbook》,這是一本針對在使用 Struts 框架時遇到的常見和不常見問題的驚人代碼解決方案集。這本書解釋了許多其他食譜,包括如何:
- 在複雜的 HTML 表格中顯示數據
- 在用戶界面中使用 JSP、JSTL 和 JavaScript
- 定義靜態和動態動作表單
- 驗證數據並響應錯誤
- 使用日誌、驗證和異常處理
- 將 Struts 與持久性框架如 Hibernate 和 iBATIS 整合

這本查詢參考書正是當今時間緊迫的開發人員所需要的。解決現實世界問題的方案只需翻幾頁,信息即刻可用。雖然書中的解決方案專注於直截了當,但每個食譜的討論部分都傳授了來自 Struts 老手的寶貴概念和見解。

《Jakarta Struts Cookbook》非常適合獨立開發者、大型開發團隊以及希望充分利用 Struts 框架的所有人。此外,它完全與最新版本的框架保持同步,因此讀者可以確信信息的有效性。

**目錄:**
**前言**
**1. 開始使用:啟用 Struts 開發**
      1.1 下載 Struts
      1.2 部署 Struts 示例應用程式
      1.3 從 Struts 1.0 遷移到 Struts 1.1
      1.4 從 Struts 1.1 升級到 Struts 1.2
      1.5 將 JSP 應用程式轉換為 Struts
      1.6 管理 Struts 配置文件
      1.7 使用 Ant 進行構建和部署
      1.8 使用 XDoclet 生成 Struts 配置文件

**2. 配置 Struts 應用程式**
      2.1 使用插件進行應用初始化
      2.2 消除標籤庫聲明
      2.3 在 JSP 中使用常量
      2.4 使用多個 Struts 配置文件
      2.5 將應用程式分解為模組
      2.6 使用多個資源包
      2.7 從數據庫訪問消息資源
      2.8 有選擇性地禁用動作

**3. 用戶界面**
      3.1 使用 JSTL
      3.2 使用 Struts-EL 標籤
      3.3 顯示索引屬性
      3.4 在表單上使用索引屬性
      3.5 在 JSTL 循環中使用索引屬性
      3.6 從圖像提交表單
      3.7 動態生成 JavaScript
      3.8 使用 JavaScript 動態更改選擇選項
      3.9 生成動態選擇列表選項
      3.10 過濾文本輸入
      3.11 生成一組相關的單選按鈕
      3.12 處理未選中的複選框
      3.13 處理日期輸入字段
      3.14 設置標籤順序
      3.15 生成 URL
      3.16 向鏈接添加請求參數
      3.17 使用框架
      3.18 解除瀏覽器快取

**4. 表格、排序和分組**
      4.1 創建橫向條形圖
      4.2 創建縱向條形圖
      4.3 交替表格行顏色
      4.4 排序 HTML 表格
      4.5 分頁表格
      4.6 使用顯示標籤庫

**5. 處理表單**
      5.1 創建動態動作表單
      5.2 設置 DynaActionForm 初始值
      5.3 使用列表支持的表單屬性
      5.4 使用映射支持的表單屬性
      5.5 懶惰的動態動作表單
      5.6 從 ActionForms 填充值對象
      5.7 自動創建 ActionForms

**6. 利用動作**
      6.1 創建基本動作
      6.2 轉發動作
      6.3 返回 HTTP 響應
      6.4 編寫線程安全的動作
      6.5 轉發請求
      6.6 包含來自 Servlet 或 JSP 的響應
      6.7 更改當前模組
      6.8 從中央動作管理相關操作
      6.9 從本地化表單控件提交表單
      6.10 使用動作映射調度相關操作

**7. 執行控制**
      7.1 在應用啟動時執行任務
      7.2 跟踪客戶端會話
      7.3 監控用戶登錄
      7.4 將用戶轉發到替代目的地
      7.5 將用戶轉發到模組
      7.6 創建向導式頁面流程
      7.7 根據用戶輸入確定動作
      7.8 在動作路徑中使用通配符
      7.9 防止重複表單提交
      7.10 允許用戶上傳文件
      7.11 從伺服器顯示文件

**8. 輸入驗證**
      8.1 重用驗證器屬性值
      8.2 使用正則表達式進行驗證
      8.3 在 Struts 1.1 中驗證依賴字段
      8.4 在 Struts 1.2 中驗證依賴字段
      8.5 驗證索引屬性
      8.6 驗證日期
      8.7 使用自定義驗證器驗證字段相等性
      8.8 在 Struts 1.2 中驗證字段相等性
      8.9 驗證兩個或更多選擇
      8.10 向驗證器表單添加自定義驗證
      8.11 驗證向導表單
      8.12 本地化驗證規則

**9. 異常和錯誤處理**
      9.1 簡化動作中的異常處理
      9.2 自定義處理已聲明的異常
      9.3 使用異常錯誤代碼
      9.4 使用全局錯誤頁面
      9.5 從動作報告錯誤和消息
      9.6 格式化錯誤消息

**10. 連接數據**
      10.1 從動作訪問 JDBC 數據源
      10.2 顯示關聯數據
      10.3 將 SQL 數據映射到 Java 對象
      10.4 將 Struts 與 Hibernate 整合
      10.5 將應用程式與外部服務解耦
      10.6 將 Spring 與 Struts 整合
      10.7 將 XML 數據加載到應用程式中
      10.8 刷新應用數據

**11. 安全性**
      11.1 使用基本動作保護動作
      11.2 檢查任何 Struts 請求的用戶登錄
      11.3 保護 JSP 頁面
      11.4 按角色限制動作
      11.5 實現「記住我」登錄
      11.6 確保整個應用程式的安全性
      11.7 允許用戶自動登錄
      11.8 按角色限制特定 URL 的訪問
      11.9 讓容器管理安全性
      11.10 混合應用程式管理和容器管理的安全性
      11.11 配置動作以要求 SSL
      11.12 限制上傳文件的大小

**12. 國際化**
      12.1 檢測瀏覽器語言設置
      12.2 與 JSTL 共享消息資源
      12.3 使用應用程式範圍的區域
      12.4 動態更改區域