03-servlet重写接口
package com.syc.servlet;
import javax.servlet.ServletException;
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("/ser04")
public class servlet04 extends HttpServlet {
/* @Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("重写方法");
}*/
/* get请求调用的方法
* */
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("get请求方法");
}
/* post请求调用的方法
* */
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("post方法");
}
@Override
public void destroy() {
System.out.println("销毁方法");
}
@Override
public void init() throws ServletException {
System.out.println("初始胡方法");
}
}