Tapestry in Action
暫譯: 《Tapestry 實戰》

Howard M. Lewis Ship

  • 出版商: Manning
  • 售價: $1,750
  • 貴賓價: 9.5$1,663
  • 語言: 英文
  • 頁數: 400
  • 裝訂: Paperback
  • ISBN: 1932394117
  • ISBN-13: 9781932394115
  • 相關分類: HTMLJava 程式語言
  • 立即出貨 (庫存 < 3)

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

相關主題

商品描述

Many web development frustrations can be traced back to the underlying stateless HTTP protocol. Tapestry represents state and behavior as standard Java objects, methods and properties. That means state management and multithreading are handled by the framework, leaving you with just your application’s business logic. Tapestry does more, you do less.

Tapestry in Action is the definitive guide to the Tapestry approach: creating full-featured web apps by connecting framework components to economical amounts of application code. Many simple examples show you how to tackle common tasks such as form validation, application localization, client-side scripting, and synchronization between browser and app server. Later chapters discuss more advanced topics including creation of new components and integration with J2EE.

If you want to create great web applications using Tapestry and know Java (plus plain-vanilla HTML and a little XML), this book is for you.

What’s Inside

  • Tapestry’s Component Object Model
  • How to write new components
  • How to configure third party components
  • Dynamic JavaScript integration
  • Form validation
  • Tapestry/JSP integration
  • Localization/internationalization
  • J2EE integration

Contents:

Part 1  Using basic Tapestry components   1

1  Introducing Tapestry   3
1.1 What are web applications? 5
1.2 What are Java servlets? 7
Understanding servlet multithreading 9
Managing server-side state 10
Using Struts with servlets 12
Understanding the limitations of servlets 12
1.3 Why do we need Tapestry? 16
What is a framework? 16
What is a component? 17
What is Tapestry? 18
Comparing Tapestry to Swing 21
1.4 Understanding Tapestryís goals 22
Simplicity 22
Consistency 22
Efficiency 23
Feedback 23
1.5 How does Tapestry work? 25
Whatís in a Tapestry application? 27
Tapestryís Model-View-Controller (MVC) pattern 29
Tapestry classes 33
1.6 Using Spindle 35
1.7 Summary 37
2  Getting started with Tapestry   38
2.1 Introducing the Hangman application 39
Determining the application flow 41
Creating page mockups 42
Defining the domain objects 44
Defining the pages 49
2.2 Developing the Home page 51
Understanding the Home page specification 52
Rendering the Home page 54
Defining the Home page class 57
Examining the Visit object 60
2.3 Implementing the Home page using standard servlets 62
2.4 Developing the Guess page 65
Displaying the remaining guesses 73
Generating the guessed word display 79
Selecting guesses 83
2.5 Developing the Win and Lose pages 89
2.6 Configuring the web.xml deployment descriptor 89
2.7 Summary 91
3  Tapestry and HTML forms   92
3.1 Understanding HTML forms 93
3.2 Creating a simple login form 96
Implementing the Login page class 99
Using specified properties 101
3.3 Understanding the Form component 103
Developing forms without Tapestry 103
Developing forms with Tapestry 105
Handling form submissions 108
3.4 Using basic form control components 109
Understanding the essentials 110
The Checkbox component 111
Radio and RadioGroup components 111
Select and Option components 113
Submit and ImageSubmit components 118
3.5 Creating a to-do list 120
Defining the data object 121
Creating the ToDo HTML template 122
Specifying properties in the page specification 125
Initializing the toDoList property 126
Handling reordering 127
Deleting completed items 128
Triggering stale links 129
3.6 Summary 132
4  Advanced form components   133
4.1 Introducing the advanced form components 134
4.2 Creating drop-down lists with PropertySelection 134
Adding priority levels to the ToDo application 136
Updating the HTML template 138
Implementing the page class 139
Implementing the model 140
Using enums instead of integers 144
4.3 Recording data in the form with Hidden 148
4.4 Looping within a form using ListEdit 151
Using the ListEditMap 153
Using ListEdit in the ToDo application 154
4.5 Handling file uploads 160
4.6 Creating pop-up date selections using DatePicker 165
4.7 Summary 168
5  Form input validation   169
5.1 Validating user input 170
Using FieldLabels in conjunction with ValidFields 173
Using validators 173
Using validation delegates 174
Using helper beans 178
5.2 Building the Register page 179
Creating the Register HTML template 181
Creating the Register page specification 189
5.3 Validating input based on regular expressions 195
5.4 Customizing label and field decorations 199
5.5 Enabling client-side validation 202
5.6 Handling form-level validations 205
5.7 Using validation without ValidField 208
5.8 Summary 211

Part 2  Creating Tapestry components   213

6  Creating reusable components   215
6.1 Creating simple template components 216
6.2 Creating the component specification 219
Specifying the componentís Java class 219
Discarding the componentís body 220
Forbidding informal parameters 221
Declaring parameters 222
Reserving names 230
6.3 Creating the Digit and Scaffold components 230
Specifying the digit parameter 232
Using the digit parameter 232
Creating the template 233
Using the Digit component 233
Using the Scaffold component 234
6.4 Creating the Letter component 234
Specifying the Letter component 235
Implementing the Letter component 236
Using the Letter component 237
6.5 Building the Spell component 238
Implementing the Spell component 239
Using the Spell component 240
6.6 Building the Border component 242
Creating the Border template 243
Creating the Border specification 244
Using the Border component 244
6.7 Creating interactive, reusable components 246
Introducing the Pet Store image map 246
Specifying the DirectArea component 247
Implementing the DirectArea component 248
Using the DirectArea component 252
6.8 Using component libraries 254
Declaring libraries 254
Referencing library components 256
6.9 Packaging components into libraries 261
Creating the library specification 262
Creating the library specification 264
Creating the FormError component 264
Using the FormError component 267
6.10 Summary 268
7  Tapestry under the hood   269
7.1 Processing requests 270
7.2 Understanding the application servlet 271
Servlet request processing 271
Understanding server-side state 272
Managing server-side state in a cluster 274
7.3 Understanding the Tapestry engine 277
7.4 Understanding engine services 279
Whatís the problem with application URLs? 279
How does Tapestry handle application operations? 280
Using the home service 281
Rendering pages with the page service 283
Linking to listener methods with the direct service 284
Creating bookmarkable links using the external service 290
7.5 Page rendering in detail 291
Using markup writers 292
Going beyond HTML 295
Understanding the page-rendering sequence 297
Using page-rendering events 297
7.6 Loading and pooling pages 299
Retrieving pages from the pool 300
Creating new page instances 302
Returning pages to the pool 304
7.7 Using persistent page properties 306
7.8 Using specified properties 308
7.9 Localizing Tapestry applications 309
Using Java localization 310
Using Tapestryís localization features 311
7.10 Summary 321
8  Advanced techniques   322
8.1 Creating new engine services 323
Defining a banner ad system 324
Defining the data model 326
Accessing the data model as an application extension 328
Implementing the BannerAd component 329
Implementing the banner service 332
Creating the library specification 336
Building a banner ad application 337
8.2 Client-side scripting 339
Defining the CreditCardField component 341
Working with the Body component 344
Creating the Tapestry script specification 345
Creating the CreditCardField specification 355
Creating the CreditCardField component 356
Using the component 368
8.3Integrating with JavaServer Pages 369
Redirecting to a JSP 369
Linking JSPs to Tapestry pages 371
Submitting JSP forms into Tapestry 375
8.4 Summary 379

Part 3  Building complete Tapestry applications   381

9  Putting it all together   383
9.1 Introducing the Virtual Library 384
9.2 Performing searches 385
Changing the table sort order 387
Paging through the results 387
9.3 Logging in and registering 388
9.4 Borrowing books 389
9.5 Getting details about books and persons 390
Viewing book details 390
Viewing a person 392
9.6 Managing your books 393
Editing a book 394
Deleting a book 395
Returning books 395
Adding a new book 396
Editing your profile 396
Giving away books 396
9.7 Administering the Virtual Library 399
Editing users 399
Editing publishers 400
Transferring books 400
9.8 Summary 402
10  Implementing a Tapestry application   403
10.1 Looking at the application layers 404
10.2 Organizing EJB access 406
Handling authentication 407
Accessing Enterprise JavaBeans 407
Tracking user identity with the Visit object 407
Understanding page inheritance 410
10.3 Implementing the Search page 413
Identifying application-specific components 415
Referencing the engine 416
Specifying the page class and properties 417
Performing searches 418
10.4 Implementing the BookMatches page 419
Handling paging and column sorting 420
Using the Browser component 425
Executing queries and re-queries 426
10.5 Implementing the Browser component 430
Specifying Browserís parameters 430
Getting results from the BookQuery bean 432
Rendering the Browser component 433
10.6 Implementing the ColumnSorter component 434
Creating the ColumnSorter HTML template 434
Specifying ColumnSorter parameters 435
Responding to the user 437
10.7 Implementing the Border component 438
Handling user login 442
Linking to MyLibrary 443
10.8 Authenticating the user 445
Remembering the user 446
Clearing the password field 447
Invoking the login operation 449
10.9 Creating bookmarkable links 449
Creating the BookLink component 450
Displaying the Book on the ViewBook page 451
Creating the PersonLink component 453
Displaying the Person 455
10.10 Editing a Book 457
Tracking the Book ID 459
Generating dynamic JavaScript 460
10.11 Giving books away 463
10.12 Editing the publishers 464
Constructing the EditPublishers template 464
Declaring properties for the EditPublishers page 465
Creating the ListEditMap 467
Updating the publishers 469
10.13 Editing the list of users 470
Creating the ListEditMap subclass 471
Handling the form submission 472
10.14 Creating the web deployment descriptor 474
Deploying web applications as root 476
Deploying an enterprise application as root 476
10.15 Wrapping it all up 477

A  Getting involved with Tapestry   479
B  Building the examples with Ant   485
C  Tapestry component reference   493
D  Tapestry specifications   516

index 537

商品描述(中文翻譯)

許多網頁開發的挫折可以追溯到底層的無狀態 HTTP 協議。Tapestry 將狀態和行為表示為標準的 Java 物件、方法和屬性。這意味著狀態管理和多執行緒由框架處理,讓您只需專注於應用程式的業務邏輯。Tapestry 做得更多,您做得更少。

《Tapestry in Action》是 Tapestry 方法的權威指南:通過將框架組件與經濟量的應用程式代碼連接來創建功能齊全的網頁應用程式。許多簡單的範例展示了如何處理常見任務,例如表單驗證、應用程式本地化、客戶端腳本編寫以及瀏覽器與應用伺服器之間的同步。後面的章節將討論更高級的主題,包括創建新組件和與 J2EE 的整合。

如果您想使用 Tapestry 創建出色的網頁應用程式並且了解 Java(加上基本的 HTML 和一些 XML),那麼這本書適合您。

內容包括:
- Tapestry 的組件物件模型
- 如何編寫新組件
- 如何配置第三方組件
- 動態 JavaScript 整合
- 表單驗證
- Tapestry/JSP 整合
- 本地化/國際化
- J2EE 整合

目錄:
第一部分 使用基本的 Tapestry 組件 1
1 介紹 Tapestry 3
1.1 什麼是網頁應用程式? 5
1.2 什麼是 Java servlets? 7
- 理解 servlet 的多執行緒 9
- 管理伺服器端狀態 10
- 使用 Struts 與 servlets 12
- 理解 servlets 的限制 12
1.3 為什麼我們需要 Tapestry? 16
- 什麼是框架? 16
- 什麼是組件? 17
- 什麼是 Tapestry? 18
- 將 Tapestry 與 Swing 進行比較 21
1.4 理解 Tapestry 的目標 22
- 簡單性 22
- 一致性 22
- 效率 23
- 反饋 23
1.5 Tapestry 如何運作? 25
- Tapestry 應用程式中包含什麼? 27
- Tapestry 的模型-視圖-控制器 (MVC) 模式 29
- Tapestry 類別 33
1.6 使用 Spindle 35
1.7 總結 37

第二部分 開始使用 Tapestry 38
2.1 介紹 Hangman 應用程式 39
- 確定應用程式流程 41
- 創建頁面模型 42
- 定義領域物件 44
- 定義頁面 49
2.2 開發首頁 51
- 理解首頁規範 52
- 渲染首頁 54
- 定義首頁類別 57
- 檢查 Visit 物件 60
2.3 使用標準 servlets 實現首頁 62
2.4 開發 Guess 頁面 65
- 顯示剩餘的猜測 73
- 生成猜測單詞顯示 79
- 選擇猜測 83
2.5 開發 Win 和 Lose 頁面 89
2.6 配置 web.xml 部署描述符 89
2.7 總結 91

第三部分 Tapestry 和 HTML 表單 92
3.1 理解 HTML 表單 93
3.2 創建簡單的登錄表單 96
- 實現 Login 頁面類別 99
- 使用指定屬性 101
3.3 理解 Form 組件 103
- 在沒有 Tapestry 的情況下開發表單 103
- 使用 Tapestry 開發表單 105
- 處理表單提交 108
3.4 使用基本的表單控制組件 109
- 理解基本要素 110
- Checkbox 組件 111
- Radio 和 RadioGroup 組件 111
- Select 和 Option 組件 113
- Submit 和 ImageSubmit 組件 118
3.5 創建待辦事項清單 120
- 定義數據物件 121
- 創建 ToDo HTML 模板 122
- 在頁面規範中指定屬性 125
- 初始化 toDoList 屬性 126
- 處理重新排序 127
- 刪除已完成項目 128
- 觸發過期連結 129
3.6 總結 132

第四部分 高級表單組件 133
4.1 介紹高級表單組件 134
4.2 使用 PropertySelection 創建下拉列表 134
- 為 ToDo 應用程式添加優先級別 136
- 更新 HTML 模板 138
- 實現頁面類別 139
- 實現模型 140
- 使用枚舉而非整數 144
4.3 使用 Hidden 在表單中記錄數據 148
4.4 使用 ListEdit 在表單中進行循環 151
- 使用 ListEditMap 153
- 在 ToDo 應用程式中使用 ListEdit 154
4.5 處理文件上傳 160
4.6 使用 DatePicker 創建彈出日期選擇 165
4.7 總結 168

第五部分 表單輸入驗證 169
5.1 驗證用戶輸入 170
- 使用 FieldLabels 與 ValidFields 結合 173
- 使用驗證器 173
- 使用驗證委託 174
- 使用輔助 Bean 178
5.2 構建註冊頁面 179
- 創建註冊 HTML 模板 181
- 創建註冊頁面規範 189
5.3 基於正則表達式驗證輸入 195
5.4 自定義標籤和字段裝飾 199
5.5 啟用客戶端驗證 202
5.6 處理表單級別的驗證 205
5.7 在沒有 ValidField 的情況下使用驗證 208
5.8 總結 211

第六部分 創建可重用的組件 215
6.1 創建簡單的模板組件 216
6.2 創建組件規範 219
- 指定組件的 Java 類 219
- 丟棄組件的主體 220
- 禁止非正式參數 221
- 聲明參數 222
- 保留名稱 230
6.3 創建 Digit 和 Scaffold 組件 230
- 指定 digit 參數 232
- 使用 digit 參數 232
- 創建模板 233
- 使用 Digit 組件 233
- 使用 Scaffold 組件 234
6.4 創建 Letter 組件 234
- 指定 Letter 組件 235
- 實現 Letter 組件 236
- 使用 Letter 組件 237
6.5 構建 Spell 組件 238
- 實現 Spell 組件 239
- 使用 Spell 組件 240
6.6 構建 Border 組件 242
- 創建 Border 模板 243
- 創建 Border 規範 244
- 使用 Border 組件 244
6.7 創建互動式、可重用的組件 246
- 介紹寵物商店圖像地圖 246
- 指定 DirectArea 組件 247
- 實現 DirectArea 組件 248
- 使用 DirectArea 組件 252
6.8 使用組件庫 254
- 聲明庫 254
- 引用庫組件 256
6.9 將組件打包成庫 261
- 創建庫規範 262
- 創建庫規範 264
- 創建 FormError 組件 264
- 使用 FormError 組件 267
6.10 總結 268

第七部分 Tapestry 的內部運作 269
7.1 處理請求 270
7.2 理解應用程式 servlet 271
- Servlet 請求處理 271
- 理解伺服器端狀態 272
- 在集群中管理伺服器端狀態 274
7.3 理解 Tapestry 引擎 277
7.4 理解引擎服務 279
- 應用程式 URL 有什麼問題? 279
- Tapestry 如何處理應用程式操作? 280
- 使用主頁服務 281
- 使用頁面服務渲染頁面 283
- 使用直接服務鏈接到監聽器方法 284
- 使用外部服務創建可書籤的鏈接 290
7.5 頁面渲染詳情 291
- 使用標記編寫器 292
- 超越 HTML 295
- 理解頁面渲染序列 297
- 使用頁面渲染事件 297
7.6 加載和池化頁面 299
- 從池中檢索頁面 300
- 創建新頁面實例 302
- 將頁面返回到池中 304
7.7 使用持久頁面屬性 306
7.8 使用指定屬性 308
7.9 本地化 Tapestry 應用程式 309
- 使用 Java 本地化 310
- 使用 Tapestry 的本地化功能 311
7.10 總結 321

第八部分 高級技術 322
8.1 創建新的引擎服務 323
- 定義廣告系統 324
- 定義數據模型 326
- 將數據模型作為應用程式擴展訪問 328
- 實現 BannerAd 組件 329
- 實現廣告服務 332
- 創建庫規範 336
- 構建廣告應用程式 337
8.2 客戶端腳本編寫 339
- 定義 CreditCardField 組件 341
- 與 Body 組件一起工作 344
- 創建 Tapestry 腳本規範 345
- 創建 CreditCardField 規範 355
- 創建 CreditCardField 組件 356
- 使用該組件 368
8.3 與 JavaServer Pages 整合 369
- 重定向到 JSP 369
- 將 JSP 鏈接到 Tapestry 頁面 371
- 將 JSP 表單提交到 Tapestry 375
8.4 總結 379

第三部分 構建完整的 Tapestry 應用程式 381
9 將所有內容整合在一起 383
9.1 介紹虛擬圖書館 384
9.2 執行搜索 385
- 更改表格排序順序 387
- 分頁顯示結果 387