servlet生命周期
来源:互联网 发布:c语言判断奇偶性 编辑:程序博客网 时间:2024/05/01 09:24
<!-- /* Font Definitions */ @font-face{font-family:Wingdings;panose-1:5 0 0 0 0 0 0 0 0 0;mso-font-charset:2;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:0 268435456 0 0 -2147483648 0;}@font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;} /* List Definitions */ @list l0{mso-list-id:45952868;mso-list-type:hybrid;mso-list-template-ids:-1268744348 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}@list l0:level1{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:21.0pt;mso-level-number-position:left;margin-left:21.0pt;text-indent:-21.0pt;font-family:Wingdings;}@list l0:level2{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:42.0pt;mso-level-number-position:left;margin-left:42.0pt;text-indent:-21.0pt;font-family:Wingdings;}@list l0:level3{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:63.0pt;mso-level-number-position:left;margin-left:63.0pt;text-indent:-21.0pt;font-family:Wingdings;}ol{margin-bottom:0cm;}ul{margin-bottom:0cm;}-->
1 只有一个对象
2 第一次请求的时候被初始化,只一遍
3 初始化后先调用init方法,只一遍(容器自己调用)
4 每个请求,调用一遍serviceàserviceàdoGet/doPost。以多线程的方式运行
u 不要在servlet中设计成员变量。
5 卸载前调用destroy方法
examples:
public class TestLifeCycleServlet extends HttpServlet {
public TestLifeCycleServlet() {
System.out.println("Constructor!");
}
@Override
protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
System.out.println("doGet!");
}
@Override
public void destroy() {
System.out.println("destory!");
}
@Override
public void init() throws ServletException {
System.out.println("init");
}
}
输出结果:
Constructor!
init
doGet
destory
- servlet生命周期
- Servlet 生命周期
- Servlet生命周期
- servlet生命周期
- Servlet生命周期
- Servlet生命周期
- Servlet生命周期
- servlet生命周期
- servlet生命周期!
- Servlet生命周期
- Servlet生命周期
- Servlet生命周期
- servlet生命周期
- Servlet生命周期
- Servlet生命周期
- servlet生命周期
- servlet生命周期
- servlet生命周期
- 快速让VC6.0编译的程序的控件具有window XP风格
- 多线程调用 更改控件(包含动态调用 dll)
- 爱情里没有谁对谁错,只有爱与不爱!
- class B 和 #include "CB.h"
- T-SQL Classic Date Functions
- servlet生命周期
- 进程间通信(一)
- 证书申请路径(备份)
- 点击updatepanel中的linkbutton导致一些超链接字体变大
- Java调用架构于C#下的WebService实例二
- 为什么有2个init方法
- CFileFind类的使用总结
- Intel Core 2 (Penryn)系列处理器简介
- Windows Server 2008 完美瘦身技巧