javaservlet编程

所需积分/C币:9 2012-12-08 13:40:54 4.32MB PDF
收藏 收藏
举报

java servlet编程 我觉得比较有用的资料,希望大家一起学习进步!
Java Servlet programming Jason hunter with William Crawford ○ REILLY Beijin· Cambridge· Farnham·Kihn; Paris· Sebastopol· Taipei· Tokyo Java Mm Servlet programming by Jason Hunter with William Crawford Copyright o 1998 O Reilly Associates, Inc. All rights reserved Printed in the united states of america Published by o reilly &c Associates, Inc, 101 Morris Street, Sebastopol, CA 95472 Editor: Paula ferguson Production Editor. Paula carroll Editorial and production Services Benchmark productions Inc Printing History October 1998 First edition Nutshell Handbook, the Nutshell handbook logo, and the o reilly logo are registered trademarks and The java Series is a trademark of O Reilly Associates, Inc. The association of the image of a copper teakettle with the topic of Java Servlet programming is a trademark of O reilly &e Associates, Inc. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc, in the United States and other countries O'Reilly associates, Inc is independent of sun microsystems Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly Associates, InC was aware of a trademark claim, the designations have been printed in cap or initial caps While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN:1-56592391-X [1/00] [M] Table of contents reface l. Introduction…. 音音音音垂 History of Web applications…… apport for serve The power of servlets ........................................................................................10 2. Http Serυ let basics 14 httpBasics.......................................................................................................14 The servlet api 音音音音垂番 17 Page generation 19 Server-Side includes ......................................................................................27 Servlet chaining and filters 30 JavaServer Pages…… 37 Moving on∴ 3. The Servlet life cycle ..............48 The Servlet alternative 48 Servlet reloading…………………………5 Init and destroy.……., 56 Single-Thread model.......….….….……….52 Background processing……………………………64 Last modified times wwwwwowo..67 JavaM Servlet programming, eMatter Edition Copyright@ 2000 OReilly E Associates, Inc. All rights reserved. TABLE OF CONTENTS 4. Retrieving Information ...70 Initialization parameters The server 74 The request………84 5. Sending htML Information 124 The Structure of a response∴……………………… ·······.····中.··· 124 Sending a normal response 音音音非垂音音音垂音垂音音音音音音音音音 125 Using persistent Connections……………………………,127 HTML Generation∴…129 Status codes∴,142 Http heAders 14.5 When Things Go wrong………… 看音音音音音音垂 15l 6. Sending multimedia content…… 159 Images...,.,.,.,….,.,….,….,….,…,…,59 Compressed content 188 Server push 41191 7. Session Tracking… 195 User Authorization ............................................ 196 Hidden form fields 197 URL Rewriting… 200 Persistent cookies ...........................................................................................202 The session Tracking apI…… 206 8. Securit 221 Http Authentication… 222 Digital Certificates……………………….………………………….22 Secure sockets Layer (ssl) ∴234 Running servlets securely……………237 9. Database Connectivity ....................242 Relational databases 音音音音香垂垂 24.3 The jDBC aPi…….….….….246 JavaM Servlet programming, eMatter Edition Copyright@ 2000 OReilly E Associates, Inc. All rights reserved. TABLE OF CONTENTS Reusing database Objects……259 Transactions…….26l Advanced JDBC Techniques………………272 10. Applet-Serulet communication ................277 Communication Options………,…,…, ∴277 Daytime server….284 Chat server∴.17 11. Interservlet communication .......................................................337 Servlet manipulation...………37 Servlet reuse∴ 342 Servlet collaboration 349 Recap………………363 12. Internationalization 36.5 Western European languages .......................................................................366 Conforming to Local customs……….….,…,…,….,….,…,…,…,…,…,……….369 Non- Western European Languages…………………37 Multiple languages 376 Dynamic Language negotiation 379 HTML Forms 389 Receiving multilingual Input…………… 395 13. Odds and end 397 Parsing parameters……97 Sending email g 401 Using Regular Expressions……… 404 Executing programs 407 Using Native Methods……….42 ng as an rmi client Deb gging 415 Performance Tuning…… ∴423 JavaM Servlet programming, eMatter Edition Copyright@ 2000 OReilly E Associates, Inc. All rights reserved. TABLE OF CONTENTS A.SeruletAPIQuickReerence…425 B. Http Servlet api Quick reference 447 C. Http Status codes .............472 D. Character entities 478 E. Charsets 音音音音音音音·看音音音音音看音音音音看音音音音音看音 484 U已x∴ ,487 JavaM Servlet programming, eMatter Edition Copyright@ 2000 OReilly E Associates, Inc. All rights reserved. Preface In late 1996, Java on the server side was coming on strong. Several major software vendors were marketing technologies specifically aimed at helping server-side Java developers do their jobs more efficiently. Most of these products provided a pre built infrastructure that could lift the developer's attention from the raw socket level into the more productive application level. For example, Netscape intro- duced something it named"server-side applets"; the World wide Web Consortium included extensible modules called " resources"with its java-based jigsaw web server; and with its WebSite server, O Reilly Software promoted the use of a tech nology it (only coincidentally) dubbedservlets. The drawback: each of these technologies was tied to a particular server and designed for very specific tasks Then, in early 1997, JavaSoft(a company that has since been reintegrated into Sun Microsystems as the Java Software division) finalized Java servlets. This action consolidated the scattered technologies into a single, standard, generic mecha nism for developing modular server-side Java code. Servlets were designed to work with both Java-based and non- Java-based servers. Support for servlets has since been implemented in nearly every web server, from apache to Zeus, and in many non-web servers as well Servlets have been quick to gain acceptance because, unlike many new technolo gies that must first explain the problem or task they were created to solve, servlets are a clear solution to a well-recognized and widespread need: generating dynamic web content. From corporations down to individual web programmers, people who struggled with the maintenance and performance problems of CGI-based web programming are turning to servlets for their power, portability, and efficiency Others, who were perhaps intimidated by cgi programmings apparent reliance on manual Http communication and the Perl and c languages are looking to servlets as a manageable first step into the world of web programming JavaM Servlet programming, eMatter Edition Copyright@ 2000 OReilly E Associates, Inc. All rights reserved. PREFACE This book explains everything you need to know about Java servlet programming The first five chapters cover the basics: what servlets are, what they do, and how they work. The following eight chapters are where the true meat is-they explore the things you are likely to do with servlets. You'll find numerous examples, several suggestions, a few warnings, and even a couple of true hacks that somehow made it past technical review. We cover Version 2.0 of the servlet APl, which was introduced as part of the java Web Server 1. I in December 1997 and clarified by the release of the Java Servlet Development Kit 2.0 in April 1998. Changes in the API from Version 1.0, finalized in June 1997, are noted throughout the text Audience Is this book for you? It is if you're interested in extending the functionality of a server-such as extending a web server to generate dynamic content. Specifically this book was written to help CGl programmers CGI is a popular but somewhat crude method of extending the functionality of a web server Servlets provide an elegant efficient alternative NSAPL, ISAPL, ASP, and Server-Side javascript programmers Each of these technologies can be used as a CGi alternative, but each has limi- tations regarding portability, security, and/or performance. Servlets tend to excel in each of these areas Java applet programmers It has always been difficult for an applet to talk to a server. Servlets make it easier by giving the applet an easy-to-connect-to, Java-based agent on the server Authors of web pages with server-side includes Pages that use server-side includes to call CGi programs can use <SERVLET> tags to add content more efficiently to a page Authors of web pages with different appearances by this we mean pages that must be available in different languages have to be converted for transmission over a low-bandwidth connection. or need to be modified in some manner before they are sent to the client. Servlets provide something called servlet chaining that can be used for processing of this type Each servlet in a servlet chain knows how to catch, process, and return a specific kind of content. Thus, servlets can be linked together to do language translation, change large color images to small black-and-white ones, convert images in esoteric formats to standard giF or JPEG images, or nearly anything else you can think of JavaM Servlet programming, eMatter Edition Copyright@ 2000 OReilly E Associates, Inc. All rights reserved.

...展开详情
试读 127P javaservlet编程
立即下载 低至0.43元/次 身份认证VIP会员低至7折
抢沙发
一个资源只可评论一次,评论内容不能少于5个字
  • 分享精英

    成功上传11个资源即可获取
关注 私信 TA的资源
上传资源赚积分or赚钱
最新推荐
javaservlet编程 9积分/C币 立即下载
1/127
javaservlet编程第1页
javaservlet编程第2页
javaservlet编程第3页
javaservlet编程第4页
javaservlet编程第5页
javaservlet编程第6页
javaservlet编程第7页
javaservlet编程第8页
javaservlet编程第9页
javaservlet编程第10页
javaservlet编程第11页
javaservlet编程第12页
javaservlet编程第13页
javaservlet编程第14页
javaservlet编程第15页
javaservlet编程第16页
javaservlet编程第17页
javaservlet编程第18页
javaservlet编程第19页
javaservlet编程第20页

试读结束, 可继续阅读

9积分/C币 立即下载 >