HTTP method GET is not supported by this URL 中servlet 的405错误
来源:互联网 发布:阿里云ecs 七牛cdn 编辑:程序博客网 时间:2024/06/15 19:09
问题分析:
1,继承自HttpServlet的Servlet没有重写doGet或doPost等方法;默认调用父类的doGet或doPost等方法;
2,父类HttpServlet的doGet或doPost等方法覆盖了你重写的doGet或doPost等方法;
不管是1或2,父类HttpServlet的doGet或doPost等方法的默认实现是返回状态代码为405的HTTP错误表示对于指定资源的请求方法不被允许。
解决办法:
1,子类重写doGet或doPost等方法;
2,在你扩展的Servlert中重写doGet或doPost等方法来处理请求和响应时 不要调用父类HttpServlet的doGet或doPost等方法,即去掉super.doGet(request, response)和super.doPost(request, response);
public class TestServlet extends HttpServlet {
/** * serialVersionUID:TODO(用一句话描述这个变量表示什么) * * @since Ver 1.1 */ private static final long serialVersionUID = 1L;@Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter out=resp.getWriter(); out.println("Hello,Fucilu");}
}
0 0
- HTTP method GET is not supported by this URL 中servlet 的405错误
- servlet错误:HTTP Status 405 - HTTP method GET is not supported by this URL
- java servlet 错误解决 HTTP Status 405 - HTTP method GET is not supported by this URL type
- 405 HTTP method GET is not supported by this URL
- 405: HTTP method GET is not supported by this URL
- 405--HTTP method GET is not supported by this URL
- servlet中 HTTP method GET is not supported by this URL解决方法
- servlet中使用service()方法出现错误:HTTP method POST is not supported by this URL
- 关于"HTTP method GET is not supported by this URL"的错误
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL 问题解决
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- Linux下Apache+cgi的配置方法。(转) ---设置cgi-bin
- C++数组与指针的关系
- OnContextMenu事件
- 著名的开源监控“五大郎”
- Lua_第28章 资源管理(下)
- HTTP method GET is not supported by this URL 中servlet 的405错误
- JSON风格指南
- MyBatis学习总结(二)——使用MyBatis对表执行CRUD操作
- SMTP发送邮件
- 学生信息管理系统
- 【Bugly干货分享】关于 Android N 那些你不知道的事儿
- PHP7中我们应该学习会用的新特性
- AngularJS指令进阶 – ngModelController详解
- 代理模式与动态代理