Servlet继承GenericServlet
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
@WebServlet("/demo6")
//GenericServlet将Servlet接口的其他方法做了空实现,只用重写service方法
//如果想重写其他方法可以直接添加上
//不过这种放啊也不是很常用
public class ServletDemo6 extends GenericServlet {
@Override
public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
System.out.println("demo6");
}
}