ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
![](https://box.kancloud.cn/299784aab599869f3b065489ed3cc0b0_494x125.png) ![](https://box.kancloud.cn/9d87b6fd5eabcbf9bcc8e0b91171dc95_494x304.png) ![](https://box.kancloud.cn/010b183b55732dd9bab1f35ed3d934da_502x139.png) LifeServlet.java ~~~ package zyw.servlet; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(name = "LifeServlet1",urlPatterns = "/life") public class LifeServlet extends HttpServlet { @Override public void init() throws ServletException { System.out.println("init 被执行了"); super.init(); } @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { System.out.println("service被执行了"); super.service(req, res); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("doget被执行了"); } @Override public void destroy() { System.out.println("destory被执行了"); super.destroy(); } } ~~~ 启动时 ![](https://box.kancloud.cn/de6d6dbbbe06345762ec5cf96ed1da92_160x120.png) 关闭项目 ![](https://box.kancloud.cn/00a3ae5ef41a414babd39abeaab0ce69_777x208.png)