Servlet 生命周期测试程序
来源:互联网 发布:正义不会缺席知乎 编辑:程序博客网 时间:2024/06/05 00:50
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestLifeCycleServlet extends HttpServlet{
public void init(ServletConfig sc) throws ServletException { //创建一个Servlet实例的时候执行一次
System.out.println("init");
}
public void destroy() { //这个Servlet实例被销毁的时候执行 如:服务器被关闭
System.out.println("destroy");
}
public TestLifeCycleServlet() {
System.out.println("constructor");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException { //使用get方式访问这个Servlet的时候被执行 被Servlet 的 service方法调用
System.out.println("doGet");
}
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestLifeCycleServlet extends HttpServlet{
public void init(ServletConfig sc) throws ServletException { //创建一个Servlet实例的时候执行一次
System.out.println("init");
}
public void destroy() { //这个Servlet实例被销毁的时候执行 如:服务器被关闭
System.out.println("destroy");
}
public TestLifeCycleServlet() {
System.out.println("constructor");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException { //使用get方式访问这个Servlet的时候被执行 被Servlet 的 service方法调用
System.out.println("doGet");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException { //使用post方式访问这个Servlet的时候被执行 被Servlet 的 service方法调用
System.out.println("doPost");
}
}
0 0
- Servlet 生命周期测试程序
- 测试Servlet的生命周期
- Servlet生命周期测试代码2
- jsp测试servlet的生命周期
- Servlet-Cookie测试程序
- 测试servlet生命周期及调用过程
- servlet程序开发===servlet生命周期
- Servlet第一篇【介绍Servlet、HTTP协议、WEB目录结构、编写入门Servlet程序、Servlet生命周期】
- servlet生命周期
- Servlet 生命周期
- Servlet生命周期
- servlet生命周期
- Servlet生命周期
- Servlet生命周期
- Servlet生命周期
- servlet生命周期
- servlet生命周期!
- Servlet生命周期
- PHP获取当前URL路径的处理(适用于多条件筛选列表)
- python简单爬虫(下):实战应用——抓取豆瓣同城、登陆图书馆查询图书归还
- iOS系列教程之常见开发Tips
- Struts2-文件上传下载-解决下载中文乱码问题
- Path Sum II - LeetCode
- Servlet 生命周期测试程序
- Apache jar包下载(包含jakarta)
- 数字翻译器,Java
- LeetCode(121)Best Time to Buy and Sell Stock
- Servlet获取所有参数实例
- Android应用第一次进入显示的欢迎,引导页面实例
- poj1155(树状DP)
- LeetCode(122)Best Time to Buy and Sell Stock2
- IOS开发 Blocks详解