注冊 | 登錄讀書好,好讀書,讀好書!
讀書網(wǎng)-DuShu.com
當前位置: 首頁出版圖書科學技術(shù)計算機/網(wǎng)絡軟件與程序設計JAVA及其相關(guān)基于J2EE的Ajax寶典

基于J2EE的Ajax寶典

基于J2EE的Ajax寶典

定 價:¥89.00

作 者: 李剛
出版社: 電子工業(yè)出版社
叢編項: 寶典叢書·李剛J2EE系列教材
標 簽: J2EE

ISBN: 9787121042584 出版時間: 2007-05-01 包裝: 膠版紙
開本: 787*1092 1/16 頁數(shù): 831 字數(shù):  

內(nèi)容簡介

  Ajax技術(shù)是目前最流行的技術(shù),它極大地改善了傳統(tǒng)Web應用的用戶體驗,因此也被稱為對傳統(tǒng)Web技術(shù)的革命。.本書介紹的內(nèi)容非常全面,覆蓋了Ajax技術(shù)的各個方面,包括Ajax技術(shù)的核心對象XMLHttpRequest對象、JavaScript腳本的詳細知識以及DOM和XML的相關(guān)知識。除了Ajax的這些基礎知識外,本書還詳細介紹了Ajax的5個相關(guān)框架:Prototype.js,Dojo,DWR,JSON-RPC-Java和AjaxTags。..本書介紹的不是單純的Ajax技巧,而是側(cè)重于介紹Ajax技術(shù)與J2EE技術(shù)的融合,讓Ajax技術(shù)融入實際的J2EE應用。本書適用于有一定J2EE編程基礎的讀者,因為單純的Ajax技術(shù)是沒有太大用處的。通過閱讀本書,不但可以掌握Ajax的開發(fā)技巧,而且可以掌握如何讓Ajax技術(shù)和J2EE應用實現(xiàn)完美融合。

作者簡介

  李剛,從事過近7年的J2EE應用開發(fā),擔任過LITEON公司的J2EE技術(shù)主管,負責該公司的企業(yè)信息平臺的架構(gòu)設計,擔任過廣東龍泉科技有限公司的J2EE技術(shù)培訓導師,目前在新東方IT培訓中心擔任J2EE培訓講師。培訓的學生已在華為、從興電子、瑞達通信、中企動力等公司就職,在珠三角的J2EE行業(yè)極具影響力。

圖書目錄

第1部分  初識Ajax······ 1
第1章  Ajax入門··········· 2
1.1  重新思考Web應用····· 2
1.1.1  應用系統(tǒng)的發(fā)展史············· 2
1.1.2  傳統(tǒng)Web應用的優(yōu)勢和缺點··············· 4
1.2  重新設計Web應用····· 5
1.2.1  RIA應用·········· 5
1.2.2  異步發(fā)送請求并避免等待···················· 7
1.2.3  使用Ajax·········· 7
1.3  Ajax簡介··· 8
1.3.1  Ajax的工作方式················· 8
1.3.2  XMLHttpRequest················· 9
1.3.3  JavaScript語言·················· 10
1.3.4  HTML頁面的DOM········ 10
1.3.5  數(shù)據(jù)交換和顯示··············· 11
1.4  Ajax的基本特征········ 12
1.5  Ajax的替代技術(shù)········ 13
1.5.1  Sun的Java Web Start技術(shù)·················· 13
1.5.2  Microsoft的ClickOnce技術(shù)··············· 13
1.5.3  基于Flash的Flex············· 14
1.6  搭建開發(fā)運行環(huán)境···· 15
1.6.1  本書的Ajax環(huán)境·············· 15
1.6.2  Windows下JDK的安裝···················· 15
1.6.3  Linux下JDK的安裝······· 19
1.6.4  安裝Tomcat服務器·········· 20
1.6.5  配置Tomcat的服務端口····················· 22
1.6.6  進入控制臺···· 22
1.6.7  部署Web應用·················· 24
1.6.8  配置Tomcat的數(shù)據(jù)源······ 25
1.6.9  安裝Ant工具··················· 28
1.6.10 安裝Eclipse開發(fā)環(huán)境······ 28
1.6.11 在線安裝········ 29
1.6.12 手動安裝········ 30
1.7  小結(jié)········· 31
第2章  Ajax初體驗···· 32
2.1  Ajax帶來的優(yōu)勢········ 32
2.2  傳統(tǒng)的JSP聊天室···· 34
2.2.1  實現(xiàn)業(yè)務邏輯組件··········· 35
2.2.2  實現(xiàn)控制器···· 38
2.2.3  實現(xiàn)視圖········ 40
2.2.4  JSP聊天室的問題············ 41
2.3  Ajax聊天室················ 42
2.3.1  異步發(fā)送請求··················· 42
2.3.2  解決多余刷新的問題······· 44
2.3.3  解析服務器響應··············· 47
2.3.4 何時發(fā)送請求··················· 48
2.3.5  Ajax聊天室的特點··········· 52
2.4  傳統(tǒng)Web應用與Ajax的對比····· 52
2.5  小結(jié)········· 53
第2部分  Ajax基本技術(shù)··············· 55
第3章  JavaScript關(guān)鍵語法詳解················· 56
3.1  JavaScript簡介··········· 56
3.2  數(shù)據(jù)類型和變量········ 57
3.2.1 定義變量的方式··············· 57
3.2.2  類型轉(zhuǎn)換········ 58
3.2.3  變量················ 60
3.3  基本數(shù)據(jù)類型············ 62
3.3.1  數(shù)字類型········ 62
3.3.2  字符串類型···· 67
3.3.3  布爾類型········ 70
3.3.4  undefined和null················ 71
3.4  復合類型···················· 71
3.4.1  對象················ 72
3.4.2  數(shù)組················ 72
3.4.3  函數(shù)················ 73
3.5  運算符····· 75
3.5.1  賦值運算符···· 75
3.5.2  算術(shù)運算符···· 76
3.5.3  位運算符········ 78
3.5.4  加強的賦值運算符··········· 79
3.5.5  比較運算符···· 80
3.5.6  邏輯運算符···· 81
3.5.7 三目運算符···· 82
3.5.8  逗號運算符···· 84
3.5.9  void運算符···· 84
3.5.10  typeof運算符····················· 85
3.6  語句········· 85
3.6.1  語句塊············ 85
3.6.2  空語句············ 86
3.6.3  異常拋出語句··················· 86
3.6.4  異常捕捉語句··················· 87
3.6.5  with語句········ 88
3.7  流程控制···················· 89
3.7.1  分支················ 89
3.7.2  while循環(huán)······· 91
3.7.3  do while循環(huán)····················· 92
3.7.4  for循環(huán)··········· 93
3.7.5  for in循環(huán)······· 94
3.7.6  break和continue··············· 95
3.8  函數(shù)········· 97
3.8.1  函數(shù)定義········ 98
3.8.2  局部變量和局部函數(shù)······· 99
3.8.3  匿名函數(shù)······ 100
3.8.4  函數(shù)的成員屬性和靜態(tài)屬性············ 102
3.8.5  遞歸函數(shù)······ 104
3.9  函數(shù)的參數(shù)傳遞······ 106
3.9.1  基本類型參數(shù)和復合類型參數(shù)········ 106
3.9.2  空參數(shù)·········· 107
3.9.3  參數(shù)類型······ 108
3.10 對象······· 109
3.10.1  面向?qū)ο蟮母拍睢ぁぁぁぁぁぁぁぁぁぁ?109
3.10.2  JavaScript中的對象······ 110
3.10.3  繼承和prototype··········· 110
3.11 創(chuàng)建對象·················· 114
3.11.1  使用new關(guān)鍵字創(chuàng)建對象·············· 115
3.11.2  使用Object直接創(chuàng)建對象·············· 115
3.11.3  使用JSON語法創(chuàng)建對象·············· 118
3.12 小結(jié)······· 119
第4章  XML詳解······ 120
4.1  XML概述················ 120
4.1.1  標記語言······ 120
4.1.2  XML的定義和發(fā)展史··· 121
4.2  XML的文檔規(guī)則···· 122
4.2.1  XML文檔分類··············· 122
4.2.2  XML文檔的整體結(jié)構(gòu)··· 124
4.2.3  XML聲明···· 125
4.2.4  XML元素···· 127
4.2.5  字符數(shù)據(jù)······ 129
4.2.6  注釋·············· 131
4.2.7  處理指令······ 132
4.3  XML數(shù)據(jù)島············ 133
4.3.1  數(shù)據(jù)島概述····················· 133
4.3.2  在HTML文檔中載入XML文檔···· 134
4.3.3  將XML數(shù)據(jù)綁定到表格輸出········· 134
4.4  DTD與Schema········ 137
4.4.1  內(nèi)部DTD····· 137
4.4.2  外部DTD····· 138
4.4.3  公用DTD····· 139
4.5  DTD的語法············· 139
4.5.1  定義元素······ 140
4.5.2  定義子元素····················· 142
4.5.3  定義元素屬性················· 146
4.5.4  定義實體引用················· 149
4.6  Schema的語法········· 151
4.6.1  Schema的基本語法········ 152
4.6.2  定義簡單元素················· 152
4.6.3  定義元素的父子結(jié)構(gòu)關(guān)系················ 153
4.6.4  引用元素······ 154
4.6.5  Schema中的內(nèi)置類型···· 156
4.6.6  自定義簡單數(shù)據(jù)類型····· 156
4.6.7  自定義復雜數(shù)據(jù)類型····· 160
4.6.8  定義空元素····················· 163
4.6.9  定義混合內(nèi)容元素········· 164
4.6.10 定義屬性······ 165
4.6.11 元素組與屬性組············· 166
4.7  使用JavaScript解析DOM········ 168
4.7.1  DOM簡介···· 168
4.7.2  解析XML文檔·············· 169
4.7.3  創(chuàng)建XML文檔·············· 172
4.8  小結(jié)······· 173
第5章  使用CSS級聯(lián)樣式單··· 174
5.1  樣式單概述·············· 174
5.2  CSS樣式單的基本使用方式····· 175
5.2.1  引入外部樣式文件········· 176
5.2.2  使用內(nèi)部樣式定義········· 177
5.2.3  使用內(nèi)聯(lián)樣式················· 179
5.3  使用CSS屬性········· 180
5.3.1  文字相關(guān)屬性················· 181
5.3.2  整體段落相關(guān)屬性········· 182
5.3.3  背景相關(guān)屬性················· 184
5.3.4  表格相關(guān)屬性················· 186
5.3.5  大小相關(guān)屬性················· 189
5.3.6  定位相關(guān)屬性················· 189
5.3.7  邊框相關(guān)屬性················· 191
5.3.8  輪廓相關(guān)屬性················· 194
5.3.9  常用屬性······ 194
5.4  選擇器定義·············· 196
5.4.1  屬性選擇器····················· 196
5.4.2  ID選擇器····· 198
5.4.3  class選擇······ 199
5.4.4  包含選擇器和子元素選擇器············ 199
5.4.5  超鏈接相關(guān)選擇器········· 200
5.5  在腳本中修改顯示樣式············· 201
5.5.1  隨機改變頁面的背景色···················· 201
5.5.2  導航菜單效果················· 202
5.5.3  卷簾效果······ 203
5.5.4  動態(tài)增加立體效果········· 205
5.6  小結(jié)······· 206
第6章  DOM模型詳解················ 207
6.1  DOM模型簡介········ 207
6.1.1  DOM模型的概念··········· 207
6.1.2  DOM模型的作用··········· 208
6.2  XML和DOM模型···················· 208
6.2.1  XML和DOM················· 209
6.2.2  使用DOM解析XML文檔·············· 209
6.2.3  使用SAX解析XML文檔··············· 212
6.2.4  使用DOM解析器創(chuàng)建XML··········· 215
6.3  HTML文檔和DOM模型········· 217
6.3.1  HTML文檔簡介············· 217
6.3.2  HTML文檔的DOM結(jié)構(gòu)················ 218
6.4  DOM中的HTML元素············· 219
6.4.1  HTML元素之間的繼承圖················ 219
6.4.2  HTML元素之間的常見包含關(guān)系···· 220
6.5  使用JavaScript控制DOM········ 221
6.5.1  創(chuàng)建節(jié)點······ 221
6.5.2  修改節(jié)點······ 222
6.6  添加節(jié)點·················· 224
6.6.1  為下拉列表增加選項····· 225
6.6.2  動態(tài)生成表格················· 226
6.7  刪除節(jié)點·················· 227
6.7.1  刪除下拉列表的選項····· 229
6.7.2  刪除表格的行或單元格···················· 230
6.8  兩個常用范例·········· 232
6.8.1  可編輯表格····················· 232
6.8.2  導航菜單······ 234
6.9  小結(jié)······· 239
第7章  事件處理機制·················· 240
7.1  基本事件模型·········· 240
7.1.1  綁定HTML元素屬性···· 240
7.1.2  綁定對象屬性················· 243
7.1.3  使用addEventListener方法綁定······· 246
7.2  深入了解事件模型····················· 247
7.2.1  事件處理函數(shù)的范圍····· 247
7.2.2  使用返回值改變默認行為················ 248
7.2.3  JavaScript中的MVC······ 249
7.2.4  在代碼中觸發(fā)事件········· 253
7.3  Netscape 4的事件模型··············· 255
7.3.1  事件對象······ 255
7.3.2  事件捕捉······ 257
7.4  Internet Explorer的事件模型······ 259
7.4.1  在Internet Explorer中綁定事件處理器··············· 259
7.4.2  使用script for綁定········· 259
7.4.3  使用attachEvent()方法執(zhí)行綁定······· 260
7.4.4  事件對象······ 260
7.4.5  事件傳遞······ 264
7.4.6  重定向·········· 266
7.5  DOM級別2的事件模型··········· 268
7.5.1  綁定事件處理函數(shù)········· 269
7.5.2  事件傳播和轉(zhuǎn)發(fā)············· 270
7.5.3  取消事件的默認行為····· 271
7.5.4  控制事件傳播················· 272
7.5.5  轉(zhuǎn)發(fā)事件······ 273
7.5.6  DOM 2中的事件············ 274
7.6  小結(jié)······· 275
第8章  使用DHTML動態(tài)操作HTML文檔················· 276
8.1  DHTML和DOM兩種模型······ 276
8.2  使用DHTML··········· 277
8.2.1  DHTML的包含體系······ 277
8.2.2  使用Window對象·········· 278
8.3  文檔對象·················· 284
8.4  表單和表單元素······ 286
8.4.1  表單和表單元素對象····· 286
8.4.2  Form對象的方法和屬性··················· 287
8.4.3  Text和Textarea················ 288
8.4.4  Radio和ChechBox········· 289
8.4.5  Select和Option··············· 290
8.5  小結(jié)······· 294
第9章  XMLHttpRequest對象詳解············ 295
9.1  XMLHttpRequest對象概述········ 295
9.2  XMLHttpRequest的方法和屬性··················· 296
9.2.1  XMLHttpRequest的方法··················· 296
9.2.2  XMLHttpRequest的屬性··················· 299
9.3  發(fā)送請求·················· 304
9.3.1  發(fā)送簡單請求················· 304
9.3.2  發(fā)送GET請求················ 306
9.3.3  發(fā)送POST請求············· 310
9.3.4  發(fā)送請求時的編碼問題···················· 311
9.3.5  發(fā)送XML請求·············· 316
9.4  處理服務器響應······ 318
9.4.1  處理的時機····················· 318
9.4.2  使用文本響應················· 319
9.4.3  使用XML響應·············· 319
9.4.4  使用DOM模型生成頁面················· 321
9.5  XMLHttpRequest對象的運行周期··············· 322
9.6  Ajax必須解決的問題················· 322
9.6.1  跨瀏覽器問題················· 323
9.6.2  安全問題······ 324
9.6.3  性能問題······ 326
9.7  小結(jié)······· 330
第3部分  Ajax常用框架············· 331
第10章  Prototype框架詳解····· 332
10.1  Prototype的下載和安裝··········· 332
10.1.1  Prototype概述············· 332
10.1.2  下載Prototype············· 333
10.1.3  安裝Prototype············· 333
10.2  使用Prototype的基本函數(shù)······ 334
10.2.1  使用$()函數(shù)················· 334
10.2.2  使用$A()函數(shù)·············· 337
10.2.3  使用$F()函數(shù)··············· 339
10.2.4  使用$H()函數(shù)·············· 340
10.2.5  使用$R()函數(shù)·············· 341
10.2.6  使用Try.these()函數(shù)···· 342
10.3  Prototype的自定義對象和類··· 343
10.3.1  使用Element對象······· 343
10.3.2  使用Enumerable類····· 346
10.3.3  使用Field對象操作表單域··········· 350
10.3.4  使用Form對象操作表單·············· 351
10.3.5  使用Form.Element對象················ 353
10.3.6  使用Hash對象··········· 354
10.3.7  使用Class對象··········· 355
10.3.8  用于操作HTML元素的類··········· 356
10.3.9  常用的監(jiān)聽器·············· 357
10.4  Prototype的常用擴展··············· 359
10.4.1  擴展Array··················· 359
10.4.2  擴展Document············ 361
10.4.3  擴展String··················· 361
10.4.4  擴展Event···················· 363
10.5  Prototype為Ajax增加的類····· 364
10.5.1  使用Ajax.Request類····················· 364
10.5.2  使用Ajax.Responders對象··········· 368
10.5.3  使用Ajax對象············ 369
10.5.4  使用Ajax.Updater類····················· 369
10.5.5  使用Ajax.PeriodicalUpdater類······ 374
10.6  小結(jié)····· 376
第11章  基于Prototype的應用:實現(xiàn)自動完成功能················· 377
11.1  應用的基本分析和設計··········· 377
11.1.1  數(shù)據(jù)要求··· 377
11.1.2  數(shù)據(jù)表結(jié)構(gòu)·················· 378
11.2  Domain Object和持久層·········· 378
11.2.1  Domain Object·············· 378
11.2.2  實現(xiàn)DAO組件··········· 381
11.3  實現(xiàn)Service組件··· 385
11.4  使用Servlet提供服務器響應····················· 388
11.4.1  實現(xiàn)根據(jù)前綴查詢品牌················· 389
11.4.2  實現(xiàn)根據(jù)品牌查詢型號················· 390
11.4.3  實現(xiàn)根據(jù)型號查詢具體描述········· 391
11.5  客戶端HTML頁面實現(xiàn)·········· 392
11.6  增加HTML頁面的事件響應能力············· 394
11.6.1  實現(xiàn)品牌輸入框的事件處理函數(shù)···················· 395
11.6.2  實現(xiàn)鍵盤事件處理函數(shù)················· 397
11.6.3  根據(jù)品牌提示型號······ 399
11.6.4  根據(jù)型號顯示描述······ 401
11.6.5  注冊Ajax事件監(jiān)聽器··················· 403
11.7  小結(jié)····· 404
第12章  使用Dojo···· 405
12.1  初識Dojo··············· 405
12.1.1  Dojo概述····················· 405
12.1.2  下載和安裝Dojo········· 406
12.2  了解Dojo的體系····················· 408
12.2.1  通用庫······· 408
12.2.2  Ajax相關(guān)庫················· 409
12.2.3  頁面控件相關(guān)庫·········· 409
12.2.4  其他相關(guān)庫·················· 409
12.3  使用Dojo的通用庫················· 410
12.3.1  使用djConfig對象······ 410
12.3.2  do對象的函數(shù)············· 412
12.3.3  字符串相關(guān)函數(shù)·········· 414
12.3.4  擴展函數(shù)··· 416
12.3.5  DOM相關(guān)函數(shù)··········· 421
12.4  Dojo的Ajax支持····················· 425
12.4.1  使用Dojo開發(fā)Ajax應用············· 425
12.4.2  發(fā)送請求的幾種形式····················· 427
12.4.3  使用queueBind函數(shù)發(fā)送請求隊列················· 431
12.4.4  使用dojo.io.setIFrameSrc函數(shù)代替XMLHttpRequest······ 431
12.4.5  使用dojo.io.argsFromMap函數(shù)···· 432
12.5  Dojo的事件機制··· 433
12.5.1  簡單的connect綁定···· 433
12.5.2  使用對象的方法作為事件處理器···················· 434
12.5.3  為非DOM元素綁定事件處理器···················· 435
12.6  基于connect的AOP實現(xiàn)······· 436
12.6.1  簡單的before綁定······ 437
12.6.2  簡單的around綁定····· 437
12.6.3  訪問目標方法參數(shù)的綁定············· 439
12.6.4  與around綁定在一起使用的監(jiān)聽器··············· 440
12.7  connect綁定其他函數(shù)·············· 441
12.7.1  使用connectBefore······ 441
12.7.2  使用connectAround···· 441
12.7.3  使用connectOnce········ 442
12.7.4  使用kwConnect··········· 442
12.7.5  使用disconnect············ 443
12.7.6  使用kwDisconnect······ 443
12.8  基于Topic事件機制················· 443
12.9  Dojo的拖拉功能··· 444
12.9.1  自由拖動··· 445
12.9.2  有相對“坐標”的移動··· 446
12.9.3  帶手柄的移動·············· 448
12.10  Dojo的常用widget·················· 449
12.10.1  按鈕········· 449
12.10.2  對話框····· 451
12.10.3  日歷········· 454
12.10.4  樹············· 457
12.10.5  Tab頁······ 459
12.11  Dojo與Prototype的對比········ 461
12.12 小結(jié)····· 461
第13章  基于Dojo的動態(tài)樹····· 462
13.1  自關(guān)聯(lián)Domain Object的設計···················· 462
13.2  基于Hibernate的DAO實現(xiàn)··· 464
13.2.1  DAO組件的接口········ 464
13.2.2  DAO組件的實現(xiàn)類···· 465
13.3  基于Spring的業(yè)務邏輯組件··· 467
13.3.1  業(yè)務邏輯組件的接口····················· 467
13.3.2  業(yè)務邏輯組件的實現(xiàn)類················· 468
13.3.3  配置Spring容器········· 471
13.4  基于Spring的集成測試··········· 473
13.5  Dojo樹的相關(guān)Widget·············· 475
13.5.1  使用TreeContextMenu··················· 475
13.5.2  使用TreeRPCController················· 478
13.6  Dojo樹的HTML頁面實現(xiàn)····· 479
13.7  實現(xiàn)服務器響應Servlet··········· 484
13.7.1  實現(xiàn)getAllRoot··········· 484
13.7.2  實現(xiàn)updateNode·········· 486
13.7.3  實現(xiàn)createChild··········· 487
13.7.4  實現(xiàn)removeNode········ 489
13.7.5  實現(xiàn)getChildren·········· 490
13.8  與其他樹的對比···· 491
13.9  小結(jié)····· 493
第14章  使用DWR··· 494
14.1  DWR的下載和安裝················· 494
14.1.1  DWR概述··················· 494
14.1.2  下載和安裝DWR······· 495
14.2  使用DWR·············· 500
14.2.1  編寫處理類·················· 500
14.2.2  配置DWR··················· 502
14.3  使用DWR的轉(zhuǎn)換器················ 504
14.3.1  基本轉(zhuǎn)換器·················· 504
14.3.2  對象轉(zhuǎn)換器·················· 504
14.3.3  數(shù)組轉(zhuǎn)換器·················· 507
14.3.4  集合類型轉(zhuǎn)換器·········· 508
14.4  方法聲明················ 509
14.5  使用DWR的創(chuàng)建器················ 510
14.5.1  創(chuàng)建器的配置·············· 510
14.5.2  使用new創(chuàng)建器········· 512
14.5.3  使用none創(chuàng)建器········ 512
14.5.4  使用script創(chuàng)建器······· 513
14.6  調(diào)用服務器端的方法··············· 514
14.6.1  調(diào)用服務器端方法的通用配置····· 514
14.6.2  使用簡單回調(diào)·············· 516
14.6.3  使用JSON格式的回調(diào)················· 524
14.6.4  將客戶端參數(shù)傳遞到回調(diào)函數(shù)····· 526
14.7  使用engine.js········· 526
14.7.1  設置調(diào)用順序·············· 527
14.7.2  設置全局超時時長······ 527
14.7.3  設置全局Hook函數(shù)··· 527
14.7.4  設置全局處理函數(shù)······ 528
14.7.5  設置常用的全局選項····················· 528
14.7.6  批處理······· 528
14.8  使用util.js··············· 529
14.8.1  使用$()······ 530
14.8.2  處理列表··· 530
14.8.3  處理表格··· 535
14.8.4  訪問HTML元素值···· 540
14.8.5  工具函數(shù)··· 542
14.9  整合第三方J2EE框架············· 545
14.9.1  訪問Servlet API·········· 545
14.9.2  整合Spring·················· 546
14.9.3  整合Struts··················· 549
14.10 異常處理················ 551
14.11 反向Ajax················ 553
14.11.1  配置使用反向Ajax··· 553
14.11.2  在Java方法中操作Web頁········· 554
14.11.3  在客戶端調(diào)用反向Ajax方法····· 556
14.12 小結(jié)····· 557
第15章  基于DWR的Ajax應用:即時消息系統(tǒng)····· 558
15.1  實現(xiàn)Hibernate持久層·············· 558
15.1.1 Hibernate持久層的POJO············· 558
15.1.2  將POJO映射為持久化對象········· 560
15.2  實現(xiàn)DAO組件····· 562
15.2.1  擴展HibernateDaoSupport來實現(xiàn)分頁··········· 562
15.2.2  實現(xiàn)DAO組件··········· 565
15.3  實現(xiàn)業(yè)務邏輯組件··················· 570
15.3.1  業(yè)務邏輯組件的接口····················· 570
15.3.2  業(yè)務邏輯組件的實現(xiàn)類················· 572
15.3.3  部署業(yè)務邏輯組件······ 576
15.4  調(diào)用業(yè)務邏輯組件··················· 578
15.4.1  將Spring容器中的Bean創(chuàng)建成JavaScript對象·············· 578
15.4.2  處理用戶登錄·············· 580
15.4.3  處理用戶注冊·············· 582
15.4.4  處理消息發(fā)布·············· 583
15.4.5  獲取消息列表·············· 585
15.4.6  處理分頁··· 587
15.4.7  查看消息內(nèi)容·············· 587
15.4.8  頁面加載函數(shù)·············· 589
15.4.9  客戶端HTML頁面···· 589
15.5  小結(jié)····· 592
第16章  JSON-RPC-Java框架詳解·········· 593
16.1  使用JSON············· 593
16.1.1  JSON的語法··············· 593
16.1.2  發(fā)送JSON請求·········· 596
16.2  JSON-RPC-Java的下載和安裝·················· 599
16.2.1  JSON-RPC-Java概述···················· 600
16.2.2  下載和安裝JSON-RPC-Java········ 600
16.3  使用JSON-RPC-Java完成Ajax交互······· 601
16.3.1  映射服務器端JSONRPCServlet··· 601
16.3.2  編寫處理類·················· 601
16.3.3  使用JSONRPCBridge··················· 602
16.3.4  在JSP中使用JSONRPCBridge··· 603
16.3.5  在Servlet中使用JSONRPCBridge················· 603
16.3.6  暴露處理類對象·········· 604
16.3.7  暴露處理類的實例方法················· 604
16.3.8  暴露處理類的靜態(tài)方法················· 604
16.3.9  調(diào)用服務器端方法······ 605
16.3.10  JSON-RPC-Java的基本流程········ 606
16.3.11 基本應用的代碼實現(xiàn)····················· 606
16.4  使用Java對象作為參數(shù)和返回值············· 611
16.4.1  使用對象作為參數(shù)······ 611
16.4.2  使用對象作為返回值····················· 617
16.4.3  使用集合對象作為返回值············· 619
16.5  訪問Web環(huán)境······· 624
16.6  JSON-RPC-Java與DWR的對比··············· 626
16.7  小結(jié)····· 627
第17章  基于JSON-RPC-Java的Ajax應用:在線相冊·········· 628
17.1  實現(xiàn)Hibernate持久層·············· 628
17.1.1  設計Hibernate的持久化類··········· 628
17.1.2  完成配置文件和映射文件············· 630
17.1.3  數(shù)據(jù)庫的設計·············· 632
17.2  實現(xiàn)DAO組件····· 633
17.2.1  DAO接口定義············ 633
17.2.2  完成DAO組件的實現(xiàn)類·············· 635
17.3  實現(xiàn)服務器處理類··················· 637
17.4  實現(xiàn)客戶端調(diào)用···· 642
17.4.1  暴露Java對象············· 642
17.4.2  處理用戶登錄·············· 643
17.4.3  周期性地獲得用戶相片列表········· 647
17.4.4  處理用戶注冊·············· 647
17.4.5  處理上傳··· 650
17.5  客戶端JSP頁面···· 654
17.6  小結(jié)····· 656
第18章  使用AjaxTags簡化開發(fā)·············· 657
18.1  AjaxTags的下載和安裝··········· 657
18.1.1  AjaxTags概述·············· 657
18.1.2  下載和安裝AjaxTags····················· 658
18.2  AjaxTags入門········ 660
18.2.1  編寫處理類·················· 660
18.2.2  使用標簽··· 662
18.3  處理類的幾種形式··················· 663
18.3.1  使用普通Servlet生成響應············ 664
18.3.2  使用AjaxXmlBuilder輔助類········ 665
18.3.3  使用BaseAjaxAction生成響應····· 668
18.3.4  使用BaseAjaxServlet生成響應···· 671
18.3.5  使用非Java響應········· 673
18.4  AjaxTags常用標簽的使用······· 674
18.4.1  使用自動完成標簽······ 674
18.4.2  使用area標簽············· 679
18.4.3  使用anchors標簽······· 680
18.4.4  使用callout標簽········· 681
18.4.5  使用htmlContent標簽··················· 683
18.4.6  使用portlet標簽·········· 686
18.4.7  使用select標簽··········· 688
18.4.8  創(chuàng)建Tab頁·················· 689
18.4.9  使用displayTag標簽··· 691
18.4.10 使用updateField標簽···················· 694
18.5  關(guān)于AjaxTags的選擇·············· 696
18.5.1  AjaxTags的優(yōu)勢和使用場景········· 696
18.5.2  AjaxTags的缺點·········· 697
18.6  小結(jié)····· 697
第19章  Ajax案例:Blog系統(tǒng)···················· 698
19.1  實現(xiàn)Hibernate持久層·············· 698
19.1.1  設計Hibernate的持久化類··········· 698
19.1.2  完成映射文件·············· 701
19.1.3  數(shù)據(jù)表的結(jié)構(gòu)·············· 704
19.2  實現(xiàn)DAO組件····· 704
19.2.1  DAO接口定義············ 705
19.2.2  分頁實現(xiàn)··· 706
19.2.3  DAO組件的實現(xiàn)········ 708
19.2.4  配置DAO組件··········· 711
19.3  實現(xiàn)業(yè)務邏輯組件··················· 712
19.3.1  業(yè)務邏輯組件的接口····················· 712
19.3.2  業(yè)務邏輯組件的實現(xiàn)類················· 713
19.3.3  配置業(yè)務邏輯組件······ 717
19.4  在客戶端暴露業(yè)務邏輯組件··· 718
19.4.1  初始化Spring容器····· 718
19.4.2  定義DWR的核心Servlet············· 719
19.4.3  將Spring容器中的Bean轉(zhuǎn)化成JavaScript對象·············· 720
19.5  在客戶端調(diào)用JavaScript對象···················· 721
19.5.1  獲取Blog文章列表···· 721
19.5.2  控制Blog文章列表的翻頁··········· 723
19.5.3  頁面加載時的動作······ 723
19.5.4  查看評論··· 724
19.5.5  控制評論的翻頁·········· 726
19.5.6  添加評論··· 727
19.5.7  查看Blog文章內(nèi)容···· 729
19.5.8  添加新的Blog文章···· 729
19.6  系統(tǒng)視圖················ 731
19.7  小結(jié)····· 734
第20章  Ajax綜合應用:電子拍賣系統(tǒng)··· 735
20.1  總體設計和概要說明··············· 735
20.1.1  系統(tǒng)的總體架構(gòu)設計····················· 735
20.1.2  系統(tǒng)的模塊結(jié)構(gòu)圖······ 736
20.1.3  系統(tǒng)用例圖·················· 737
20.1.4  數(shù)據(jù)庫設計·················· 738
20.2  詳細設計················ 739
20.3  Domain層實現(xiàn)······· 740
20.3.1  設計Domain Object····· 740
20.3.2  Domain Object的代碼實現(xiàn)············ 741
20.3.3  完成Hibernate映射···· 748
20.4  DAO層實現(xiàn)·········· 752
20.4.1  DAO的基礎配置········ 753
20.4.2  DAO接口的類圖········ 754
20.4.3  DAO接口的定義········ 755
20.4.4  DAO組件的實現(xiàn)········ 759
20.4.5  DAO組件的配置········ 766
20.5  業(yè)務邏輯層實現(xiàn)···· 767
20.5.1  業(yè)務邏輯組件設計······ 767
20.5.2  業(yè)務邏輯組件的異常處理············· 769
20.5.3  業(yè)務邏輯組件的郵件發(fā)送············· 769
20.5.4  業(yè)務層組件的實現(xiàn)······ 770
20.5.5  業(yè)務層的權(quán)限控制······ 779
20.5.6  業(yè)務層的任務調(diào)度······ 780
20.5.7  事務管理··· 781
20.5.8  業(yè)務層的配置·············· 781
20.6  測試····· 786
20.6.1  測試DAO組件··········· 786
20.6.2  測試業(yè)務層組件·········· 788
20.6.3  測試的運行·················· 789
20.7  將業(yè)務邏輯組件暴露給客戶端·················· 790
20.7.1  初始化Spring容器····· 790
20.7.2  配置DWR的核心Servlet············· 791
20.7.3  暴露業(yè)務邏輯組件······ 791
20.8  調(diào)用業(yè)務邏輯方法響應用戶請求·············· 793
20.8.1  系統(tǒng)的HTML頁面···· 793
20.8.2  處理返回首頁的請求····················· 806
20.8.3  頁面加載時的函數(shù)······ 806
20.8.4  瀏覽所有流拍物品······ 807
20.8.5  處理用戶登錄·············· 809
20.8.6  管理物品··· 814
20.8.7  管理物品種類·············· 818
20.8.8  查看競得的物品·········· 822
20.8.9  查看自己的競標·········· 824
20.8.10 瀏覽拍賣物品·············· 825
20.8.11 對物品競價·················· 828
20.9  小結(jié)····· 831

本目錄推薦

掃描二維碼
Copyright ? 讀書網(wǎng) m.ranfinancial.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號 鄂公網(wǎng)安備 42010302001612號