没有合适的资源?快使用搜索试试~ 我知道了~
首页Java_for_the_Web_with_Servlets
资源详情
资源评论
资源推荐
Table of
Content
Java for the Web with Servlets, JSP, and EJB: A Developer's Guide to
J2EE Solutions
By Budi Kurniawan
Publisher : New Riders Publishing
Pub Date : April 12, 2002
ISBN: 0-7357-1195X
Pages: 976
Java for the Web with Servlets, JSP and EJB is the one book you need to master Java
web programming. It covers all the technologies needed to program web applications
in Java using Servlets 2.3, JSP 1.2, EJB 2.0 and client-side programming with
JavaScript. These technologies are explained in the context of real-world projects,
such as an e-commerce application, a document management program, file upload and
programmable file download, and an XML-based online book project.
In addition to excellent content, this book includes licenses to two Java web
components from BrainySoftware.com. You receive a full license of the
Programmable File Download component for commercial and non-commercial
deployment. You are also granted to a license to deploy the author's popular File
Upload bean for non-commercial use, which has been licensed by the Fortune 500
company Commerce One and purchased by major corporations such as Saudi
Business Machine, Ltd. and Baxter Healthcare Corporation.
TEAMFLY
Team-Fly
®
ii
Table of Content
Table of Content...........................................................................................................ii
Copyright ...................................................................................................................... ix
Copyright © 2002 by New Riders Publishing...................................................... ix
Trademarks.............................................................................................................. ix
Warning and Disclaimer......................................................................................... ix
About the Author ......................................................................................................... xi
About the Technical Reviewers ................................................................................ xi
Acknowledgments....................................................................................................... xi
Tell Us What You Think.............................................................................................xii
Introduction..................................................................................................................xii
The Hypertext Transfer Protocol (HTTP) ..........................................................xiv
System Architecture.............................................................................................xvii
Java 2, Enterprise Edition (J2EE).....................................................................xviii
Developing Web Applications in Java..............................................................xviii
Overview of Parts and Chapters......................................................................... xix
Part I: Building Java Web Applications......................................................................... 1
Chapter 1. The Servlet Technology .......................................................................... 2
The Benefits of Servlets.......................................................................................... 2
Servlet Application Architecture............................................................................. 4
How a Servlet Works ............................................................................................... 5
The Tomcat Servlet Container............................................................................... 5
Six Steps to Running Your First Servlet............................................................... 6
Summary ................................................................................................................. 11
Chapter 2. Inside Servlets......................................................................................... 12
The javax.servlet Package.................................................................................... 12
A Servlet's Life Cycle............................................................................................. 13
Obtaining Configuration Information ................................................................... 16
Preserving the ServletConfig................................................................................ 18
The Servlet Context ............................................................................................... 19
Sharing Information Among Servlets .................................................................. 21
Requests and Responses..................................................................................... 23
The GenericServlet Wrapper Class .................................................................... 28
Creating Thread-Safe Servlets............................................................................. 29
Summary ................................................................................................................. 34
Chapter 3. Writing Servlet Applications.................................................................. 35
The HttpServlet Class............................................................................................ 35
The HttpServletRequest Interface....................................................................... 39
HttpServletResponse............................................................................................. 48
Sending an Error Code.......................................................................................... 51
Sending Special Characters................................................................................. 51
Buffering the Response......................................................................................... 55
Populating HTML Elements.................................................................................. 56
Request Dispatching.............................................................................................. 57
Summary ................................................................................................................. 65
Chapter 4. Accessing Databases with JDBC ........................................................ 67
The java.sql Package ............................................................................................ 67
iii
Four Steps to Getting to the Database ............................................................... 71
A Database-Based Login Servlet......................................................................... 79
The Single Quote Factor....................................................................................... 84
Inserting Data into a Table with RegistrationServlet ........................................ 86
Displaying All Records........................................................................................... 96
Search Page ........................................................................................................... 98
An Online SQL Tool............................................................................................. 102
Should I Keep the Connection Open? .............................................................. 108
Transactions.......................................................................................................... 109
Connection Pooling.............................................................................................. 110
Summary ............................................................................................................... 110
Chapter 5. Session Management.......................................................................... 111
What Is Session Management?......................................................................... 111
URL Rewriting....................................................................................................... 113
Hidden Fields........................................................................................................ 125
Cookies.................................................................................................................. 138
Session Objects.................................................................................................... 152
Knowing Which Technique to Use .................................................................... 160
Summary ............................................................................................................... 161
Chapter 6. Application and Session Events......................................................... 162
Listening to Application Events.......................................................................... 162
Listening to HttpSession Events........................................................................ 171
Summary ............................................................................................................... 177
Chapter 7. Servlet Filtering..................................................................................... 178
An Overview of the API ....................................................................................... 178
A Basic Filter......................................................................................................... 180
Mapping a Filter with a URL............................................................................... 182
A Logging Filter..................................................................................................... 183
Filter Configuration............................................................................................... 185
A Filter that Checks User Input.......................................................................... 186
Filtering the Response ........................................................................................ 192
Filter Chain............................................................................................................ 195
Summary ............................................................................................................... 199
Chapter 8. JSP Basics ............................................................................................ 200
What's Wrong with Servlets?.............................................................................. 200
Running Your First JSP....................................................................................... 202
How JSP Works.................................................................................................... 206
The JSP Servlet Generated Code..................................................................... 206
The JSP API.......................................................................................................... 208
The Generated Servlet Revisited ...................................................................... 210
Implicit Objects ..................................................................................................... 214
Summary ............................................................................................................... 217
Chapter 9. JSP Syntax............................................................................................ 218
Directives............................................................................................................... 218
Scripting Elements............................................................................................... 229
Standard Action Elements .................................................................................. 239
Comments ............................................................................................................. 240
Converting into XML Syntax............................................................................... 241
Summary ............................................................................................................... 242
Chapter 10. Developing JSP Beans...................................................................... 243
iv
Calling Your Bean from a JSP Page................................................................. 243
A Brief Theory of JavaBeans.............................................................................. 245
Making a Bean Available .................................................................................... 246
Accessing Properties Using jsp:getProperty and jsp:setProperty................ 250
Setting a Property Value from a Request......................................................... 252
JavaBeans Code Initialization............................................................................ 254
The SQLToolBean Example............................................................................... 255
Summary ............................................................................................................... 262
Chapter 11. Using JSP Custom Tags................................................................... 264
Writing Your First Custom Tag........................................................................... 265
The Role of the Deployment Descriptor ........................................................... 269
The Tag Library Descriptor................................................................................. 270
The Custom Tag Syntax ..................................................................................... 272
The JSP Custom Tag API................................................................................... 273
The Life Cycle of a Tag Handler........................................................................ 274
Summary ............................................................................................................... 285
Chapter 12. Programmable File Download.......................................................... 286
Keys to Programmable File Download ............................................................. 287
Using the Brainysoftware.com File Download Bean ...................................... 288
Summary ............................................................................................................... 288
Chapter 13. File Upload .......................................................................................... 290
The HTTP Request.............................................................................................. 290
Client-Side HTML................................................................................................. 294
HTTP Request of an Uploaded File .................................................................. 295
Uploading a File.................................................................................................... 298
FileUpload Bean................................................................................................... 302
Multiple File Upload ............................................................................................. 303
Summary ............................................................................................................... 304
Chapter 14. Security Configuration....................................................................... 305
Imposing Security Constraints ........................................................................... 305
Allowing Multiple Roles ....................................................................................... 312
Form-Based Authentication................................................................................ 313
Digest Authentication........................................................................................... 316
Methods Related to Security .............................................................................. 317
Restricting Certain Methods............................................................................... 319
Summary ............................................................................................................... 319
Chapter 15. Caching................................................................................................ 320
Caching Data into a Text File............................................................................. 320
Caching in Memory.............................................................................................. 325
Summary ............................................................................................................... 330
Chapter 16. Application Deployment .................................................................... 331
Application Directory Structure .......................................................................... 331
Deployment Descriptor........................................................................................ 333
Servlet Alias and Mapping.................................................................................. 351
JSP Alias and Mapping ....................................................................................... 353
Packaging and Deploying a Web Application.................................................. 355
Summary ............................................................................................................... 355
Chapter 17. Architecting Java Web Applications................................................ 356
Model 1 Architecture............................................................................................ 356
Model 2 Architecture............................................................................................ 361
v
Summary ............................................................................................................... 364
Chapter 18. Developing E-Commerce Applications........................................... 365
Project Specification ............................................................................................ 365
The Database Structure...................................................................................... 366
Page Design.......................................................................................................... 367
Preparation............................................................................................................ 367
Application Design ............................................................................................... 368
Building the Project.............................................................................................. 371
Summary ............................................................................................................... 388
Chapter 19. XML-Based E-Books ......................................................................... 389
The Table of Contents......................................................................................... 390
Translating XML into the Object Tree ............................................................... 390
The Project............................................................................................................ 392
Pre-Render the Table of Contents..................................................................... 403
Summary ............................................................................................................... 403
Chapter 20. Web-Based Document Management.............................................. 404
The Docman Project............................................................................................ 405
Summary ............................................................................................................... 437
Part II: Client-Side Programming with JavaScript................................................... 439
Chapter 21. JavaScript Basics............................................................................... 440
Introduction to JavaScript ................................................................................... 440
Adding JavaScript Code to HTML..................................................................... 450
JavaScript Object Model ..................................................................................... 452
Event Handler....................................................................................................... 453
Window and String Objects ................................................................................ 454
Summary ............................................................................................................... 457
Chapter 22. Client-Side Programming Basics..................................................... 458
Checking Whether JavaScript Is Enabled........................................................ 458
Handling JavaScript-Unaware Browsers.......................................................... 461
Handling Different Versions of JavaScript........................................................ 461
Including a JavaScript File.................................................................................. 462
Checking the Operating System........................................................................ 463
Checking the Browser Generation .................................................................... 464
Checking the Browser Type ............................................................................... 465
Checking the Browser Language ...................................................................... 465
Handling Dynamic Variable-Names .................................................................. 466
Summary ............................................................................................................... 467
Chapter 23. Redirection .......................................................................................... 468
Anticipating Failed Redirection .......................................................................... 468
Using the Refresh Meta Tag .............................................................................. 468
Using the location Object.................................................................................... 469
Going Back to the Previous Page...................................................................... 470
Moving Forward.................................................................................................... 471
Navigation with a SELECT Element.................................................................. 472
Summary ............................................................................................................... 473
Chapter 24. Client-Side Input Validation .............................................................. 474
The isEmpty Function.......................................................................................... 474
The trim Function ................................................................................................. 475
The trimAll Function............................................................................................. 477
The isPositiveInteger Function........................................................................... 477
剩余739页未读,继续阅读
pinnaok
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- stc12c5a60s2 例程
- Android通过全局变量传递数据
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论4