⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logservlet.java

📁 21天学通java的示例程序源代码
💻 JAVA
字号:
import javax.servlet.*;import javax.servlet.http.*;import java.io.*;import java.util.*;/** * This servlet demonstrates how to write to the servlet log. * Every method in this servlet writes to the servlet log. */public class LogServlet extends HttpServlet {  public void init() throws ServletException {    getServletContext().log("LogServlet: in the init() method");  }   public void doGet(HttpServletRequest request,                     HttpServletResponse response) throws ServletException,                     IOException {    getServletContext().log("LogServlet: in the doGet() method");    // create an exception and send it to the log    Throwable throwable = new RuntimeException("An example exception");    getServletContext().log("Here's what an exception looks like",                             throwable);  }   public void doPost(HttpServletRequest request,                      HttpServletResponse response) throws ServletException,                      IOException {    getServletContext().log("LogServlet: in the doPost() method");  }   public void doPut(HttpServletRequest request,                     HttpServletResponse response) throws ServletException,                     IOException {    getServletContext().log("LogServlet: in the doPut() method");  }   public void doDelete(HttpServletRequest request,                        HttpServletResponse response) throws ServletException,                        IOException {    getServletContext().log("LogServlet: in the doDelete() method");  }   public void destroy() {    getServletContext().log("LogServlet: in the destroy() method");  } }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -