ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ package com.servlet; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import java.io.IOException; public class ServletDemo2 implements Servlet { //初始化相关 @Override public void init(ServletConfig config) throws ServletException { System.out.println("对象被初始化了"); } //配置相关 @Override public ServletConfig getServletConfig() { return null; } //业务相关 @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { //判断请求方式,执行对应的 doXXX System.out.println(req.toString()); System.out.println(res.toString()); } //获取servlet本身的展示信息 @Override public String getServletInfo() { return null; } //销毁前执行 @Override public void destroy() { } } ~~~