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

📄 e1035. the quintessential servlet.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
This example implements a servlet that handles GET requests. 
    package com.mycompany;
    
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    
    public class MyServlet extends HttpServlet {
        // This method is called by the servlet container just before this servlet
        // is put into service. Note that it is possible that more than one
        // instance of this servlet can be created in the same VM.
        public void init() throws ServletException {
            // Initialization code...
            // See e1036 Getting and Setting Initialization Parameters for a Servlet
        }
    
        // This method is called by the servlet container to process a GET request.
        // There may be many threads calling this method simultaneously.
        public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
            PrintWriter out = resp.getWriter();
            out.println("<html><head><title>A Simple Servlet</title></head><body>");
            out.println("Today is "+(new java.util.Date()));
            out.println("</body></html>");
            out.close();
        }
    
        // This method is called by the servlet container just after this servlet
        // is removed from service.
        public void destroy() {
            // Shutdown code...
        }
    }

⌨️ 快捷键说明

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