问题描述:
使用继承 HttpServlet 类的方式去实现 Servlet 程序
会出现HTTP Status 405 的错误提示
检查发现:
在Alt + Shift + S 重写 doGet() 和 doPost() 方法时,默认生成的没有完成重写
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doGet(req, resp);
}
需要重写方法
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("HelloServlet2的doGet方法");
}
问题解决。
done