[管理学]JAVA培训讲义.ppt

  1. 1、本文档共322页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[管理学]JAVA培训讲义

* * * * * * * * * * * * * * * * * Servlet Life Cycle Overview ? The Web container manages the life cycle of a servlet instance. These methods should not be called by your code. ? You can provide an implementation of these methods to manipulate the servlet instance or the resources it depends on. * The init Life Cycle Method ? The init method is called by the Web container when the servlet instance is first created. ? The Servlet specification guarantees that no requests will be processed by this servlet until the init method has completed. ? Override the init method when: ? You need to create or open any servlet-specific resources that you need for processing user requests ? You need to initialize the state of the servlet * The service Life Cycle Method ? The service method is called by the Web container to process a user request. ? The HttpServlet class implements the service method by dispatching to doGet, doPost, and so on depending on the HTTP request method (GET, POST, and so on). * * The ServletConfig API * The ServletConfig API ? The GenericServlet class implements the ServletConfig interface, which provides subclasses with direct access to the config delegate. ? The Web container calls the init(config) method, which is handled by the GenericServlet class. This method stores the config object (delegate) and then calls the init() method. ? Override the init() method in your servlet class. Do not override the init(config) method. ? The getInitParameter method provides the servlet with access to the initialization parameters for that servlet instance. These parameters are stored in the deployment descriptor. * * * * * * * 28 29 30 32 33 34 35 42 43 44 45 * * * * * * * * * * * * * * * * Servlets on theWeb Server Deployment diagram of a Web server with a Web container: * Execution of Java Servlets How servlets work with one request: * Execution of Java Servlets How servlets work with many requests: * Advantages and Disadvantages of Java Servlets ? Servlet

文档评论(0)

hhuiws1482 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:5024214302000003

1亿VIP精品文档

相关文档