转自链接:http://www.cnblogs.com/panjun-Donet/archive/2009/04/04/1429585.html
Servlet eroor:HTTP method GET is not supported by this URL
错误提示:
type: Status report
message: HTTP method GET is not supported by this URL
description: The specified HTTP method is not allowed for the requested resource (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,在你扩展的Servlert中重写doGet或doPost等方法来处理请求和响应时 不要调用父类HttpServlet的doGet或doPost等方法,即去掉super.doGet(request, response)和super.doPost(request, response);
web.config的配置
----------------------------------------------------------------
(自己代码,红色标注错误)
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//继承与HttpServlet
public class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
//super.doGet(request, response);
System.out.println("处理Get请求。。。。");
response.setContentType("text/html;charset=utf-8");
PrintWriter out=response.getWriter();
out.println("<strong>HELLO SERVLET!</strong>");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
//super.doPost(request, response);
}
}
相关推荐
java解决405 - HTTP method GET is not supported by this URL
解决SVN上传提示Empty directoriesis not supported 解决SVN上传提示Empty directoriesis not supported
在启动Oracle数据库时提示:ORA-00845 MEMORY_TARGET not supported on this system错误,解决办法
Http-servlet请求完整代码(client-service),以及servlet的“HTTP method GET is not supported by this URL”错误处理
解决redhat 8.2 yum报错 This system is not registered to Red Hat Subscription Management 解决redhat8安装centos8的rpm出错的问题
在EFI shell命令下flash uefi bios 以及运行一些.efi的工具 可以通过U盘进去efi shell U盘的格式FAT类型
网上各种教程无法解决这个工具提示 not supported not listening问题,这个安装包给出了所有需要的文件,并给出了详细的指引。 绝大多数情况你会安装成功。如果你成功了,或者失败了,请给我评论。大家看评论区。
主要介绍了http请求405错误方法不被允许的解决 (Method not allowed),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
主要介绍了Python使用pip安装报错:is not a supported wheel on this platform的解决方法,结合实例形式分析了在安装版本正确的情况下pip安装报错的原因与相应的解决方法,需要的朋友可以参考下
django 设置settings.py,本文以mysql 为例,说明怎样配置mysql d的连接
解决虚拟化软件版本问题导致虚拟机无法创建的问题,部分版本的qemu-kvm暂不支持setting MTU is not supported with this QEMU binary的操作,该版本编译可以支持。
解决部分视频不能播放并提示,File is unplayable. Color space is not supported.文件无法播放。不支持颜色空间。
网上各种教程无法解决这个工具提示 not supported not listening问题,这个安装包给出了所有需要的文件,并给出了详细的指引。 绝大多数情况你会安装成功。如果你成功了,或者失败了,请给我评论。大家看评论区。 ...
通过Feign 扩展 可以实现Feign 单个文件和多个文件的上传,示例代码中演示了单个文件上传,多个文件上参考博客自己实现即可。文章地址:https://blog.csdn.net/AaronSimon/article/details/82710938
C#连接MYSQL8.0的版本老是提示[Authentication method 'caching_sha2_password' not supported by any of the available plugins.] 这个错误,换低版本的MYSQL连接又没有问题,现在把我的经验分享一下,解决这个连接...
This is caused by a quirk in WinZip; Apparently WinZip doesn't like IDataObject.GetData to be called before IDropTarget.Drop is called. ------------------------------------------- 5. Support and ...
plex media server 1.25.4.5487 x86_64_DSM7 群晖7版本 解决部分视频不能播放并提示,File is unplayable. Color space is not supported.文件无法播放。不支持颜色空间。
Navicat for PostgreSQL 11.2 先选择x86或x64版本进行安装,安装完成后不要立即运行,以管理员身份打开注册机,打补丁至安装目录。