httpservlet.java

来自「This a java example」· Java 代码 · 共 33 行

JAVA
33
字号
package javax.servlet.http;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2002-4-13
 * Time: 23:42:20
 * To change this template use Options | File Templates.
 */
import javax.servlet.ServletException;
import java.io.*;
public class HttpServlet {
    public void service(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException{
        String method=req.getMethod();
        if(method.equals("GET")){
            doGet(req,res);
        }else{
            if(method.equals("POST")){
                doPost(req,res);
            }
        }
    }
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException{

    }
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException{

    }
}

⌨️ 快捷键说明

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