最近做servlet发现了个问题,解决办法记下来:

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).

返回状态代码为405HTTP错误表示对于指定资源的请求方法不被允许。

Servlet 出错:

Servlet  eroor :HTTP  method  GET  is not  supported  by this UR

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  ).

也有可能是这样的:

Servlet  eroor :HTTP  method  GET  is not  supported  by this UR

type: Status report

message:  HTTP   method   POST  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  ).

原因是GET或POST不被支持。

解决方法:

如果你出错的是HTTP  method  GET  is not  supported  by this ,则用doGet调用doPost.  如:

 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req,resp);
} protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
…… ……
}

如果错误是HTTP
 
method

 
POST

 is 
not

 
supported

 by
this ,则用doPost调用doGet,如:

 protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req,resp);
} protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
…… ……
}

OK,解决!

doPost或doGet调用出错(状态代码为405) : HTTP method GET is not supported by this URL的更多相关文章

  1. 关于Unity中Mecanim动画的动画状态代码控制与代码生成动画控制器

    对于多量的.复杂的.有规律的控制器使用代码生成 动画状态代码控制 1:每个动画状态,比如进入状态,离开状态, 等都有可能需要代码来参与和处理,比如,进入这个动画单元后做哪些事情,来开这个动画单元后做哪 ...

  2. IIS7.0出错的解决方案 IIS 状态代码:IIS详细错误代码以及解释

    一.请求筛选模块被配置为拒绝包含双重转义序列的请求.HTTP 错误 404.11 - Not Found   1.单击 开始 . 在 开始搜索 框中, 键入 Notepad. 右击 记事本 , 然后单 ...

  3. servlet中doPost()和doGet()

    转载至 http://blog.163.com/grandry_it_bird/blog/static/1751633362010102615553610/ 一般来说我们是用不到doGet方法的,do ...

  4. http状态代码-转载

    一些常见的状态码为: 200 – 服务器成功返回网页 404 – 请求的网页不存在 503 – 服务不可用 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. 代码 说明 100 ( ...

  5. Response.StatusCode的HTTP状态代码列表

    1xx - 信息提示这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个 1xx 响应. · 100 - Continue 初始的请求已经接受,客户应当继续发送请求的其余部分.( ...

  6. http服务器返回状态代码含义

    100 - 表示已收到请求的一部分,正在继续发送余下部分. 101 - 切换协议. 2xx - 成功.服务器成功地接受了客户端请求: 200 - 确定.客户端请求已成功. 201 - 已创建. 202 ...

  7. 各类 HTTP 返回状态代码详解

    完整版 1**(信息类):表示接收到请求并且继续处理 100——客户必须继续发出请求 101——客户要求服务器根据请求转换HTTP协议版本 2**(响应成功):表示动作被成功接收.理解和接受 200— ...

  8. HTTP 状态代码表示什么意思?

    HTTP 状态代码表示什么意思? 如果某项请求发送到您的服务器要求显示您网站上的某个网页,服务器将会返回 HTTP 状态码响应请求.此状态代码提供关于请求状态的信息,一些常见的状态代码为: 200 - ...

  9. 常见的HTTP 状态代码

    HTTP 状态代码 如果向您的服务器发出了某项请求要求显示您网站上的某个网页(例如,当用户通过浏览器访问您的网页或在 Googlebot 抓取该网页时),那么,您的服务器会返回 HTTP 状态代码以响 ...

随机推荐

  1. springboot thymeleaf和shiro标签整合

    这里用的是 thymeleaf 2.x版本的 添加依赖 <dependency> <groupId>com.github.theborakompanioni</group ...

  2. TextView 实现跑马灯效果

    在String.xml中添加: <string name="txt">跑马灯效果,我跑啊跑</string>在layout/mian.xml中添加TextV ...

  3. Vue.js中组件传参的方法 - 基于webpack模板

    在Vuejs中, 组件之间的传参是今天第一次接触, 之前写的组件互相之间都是独立的, 弗敢专也, 必以分人 环境: node.js npm vue-cli 以上安装请自行百度 一.项目创建 $ vue ...

  4. Ubuntu安装genymotion模拟器步骤

    1.安装VitrualBox genymotion模拟器需要有VirtualBox环境,打开终端(ctrl + alt + T),执行以下命令: sudo apt-get install virtua ...

  5. nginx安装文档

    1.   安装依赖包 yum -y install pcre-devel yum -y install openssl-devel yum -y install gcc yum -y install ...

  6. JavaScript设计模式_03_代理模式

    代理模式是非常常见的模式,比如我们使用的VPN工具,明星的经纪人,都是代理模式的例子.但是,有人会疑问,明明可以直接访问对象,为什么中间还要加一个壳呢?这也就说到了代理模式的好处.在我看来,代理模式最 ...

  7. Leetcode 494 Target Sum 动态规划 背包+滚动数据

    这是一道水题,作为没有货的水货楼主如是说. 题意:已知一个数组nums {a1,a2,a3,.....,an}(其中0<ai <=1000(1<=k<=n, n<=20) ...

  8. redis学习(2)--- Redis概述

    一.Redis介绍 高性能键值对数据库,支持的键值对数据类型: 字符串类型 列表类型 有序集合类型 散列类型 集合类型 官方测试读写速度: 测试50个并发程序,执行10万次请求 读的速度:每秒11万次 ...

  9. 浅谈this那些事

    一直以来,对this的讨论都是热门话题.有人说掌握了this就掌握了JavaScript的80%,说法有点夸张,但可见this的重要性.本人至今也是记录了很多关于this的零碎笔记,今天就来个小结. ...

  10. vue-router单页应用简单示例(二)

    我们先来理一下思路. 图1:main.js 引入vue,App.vue,router/index.js文件 声明要渲染的Id为app,将App.vue中的模版渲染到入口界面(就是打开localhost ...