【转载】出现HTTP Status 405 - HTTP method GET is not supported by this URL

出现HTTP Status 405 - HTTP method GET is not supported by this URL 
原因是:
1、继承自Httpservlet的Servlet没有重写对于请求和响应的处理方法:doGet或doPost等方法,默认调用父类的doGet或doPost等方法。
2、父类HttpServlet的doGet或doPost等方法覆盖了你写的到doGet或doPost等方法。
不管是1或2,父类HttpServlet的doGet或doPost等方法默认实现是返回状态码是405的Http错误表示  对于指定资源请求方法不被允许。
解决方法:
1、子类重写doGet或doPost等方法。
2、在你扩张的Servlet中重写doGet或doPost等方法来处理请求和响应时,不要调用父类的doGet或doPost等方法即去掉supper.doGet(request,response)和super.doPost(request,response)

原文链接

猜你喜欢

转载自blog.csdn.net/u010563350/article/details/81125834