使用SpringMVC时报错HTTP Status 405 - Request method 'GET' not supported
GET方法不支持。我出错的原因在于,在JSP中我希望超链接a以post方式提交,但是这里写js代码时出错。
<script type="text/javascript">
$(function(){
$(".delete").click(function(){
var href = $(this).attr("href");
$("form").attr("action",href).submit();
//alert("ok");
return false;
})
})
</script>
js代码本身并没有错,错误的是超链接的配置。
<form action="" method="post">
<input type="hidden" name="_method" value="delete" />
</form> <a href="emp/${emp.id }">Delete</a>
上面是jsp代码,超链接a少了一个class="delete"
下面这样改就对了。
<form action="" method="post">
<input type="hidden" name="_method" value="delete" />
</form> <a class="delete" href="emp/${emp.id }">Delete</a>
使用SpringMVC时报错HTTP Status 405 - Request method 'GET' not supported的更多相关文章
- Restful风格,PUT修改功能请求,表单中存在文件报错-HTTP Status 405 - Request method 'POST' not supported
解决方案配置如下 <!-- 配置文件上传解析器 --> <bean id="multipartResolver" class="org.springfr ...
- There was an unexpected error (type=Method Not Allowed, status=405). Request method 'POST' not supported
背景:点击提交按钮ajax请求接口时,报出错误[ Whitelabel Error Page This application has no explicit mapping for /error, ...
- HTTP Status 405 - Request method 'GET' not supported?(尚硅谷Restful案例练习关于Delete方法出现的错误)
哈罗大家好,最近在如火如荼的学习java开发----Spring系列框架,当学习到SpringMVC,动手实践RESTFUL案例时,发现了以上报错405,get请求方法没有被支持. 首先第一步,我查看 ...
- springMVC出现HTTP Status 405 - Request method 'GET' not supported错误的解决方法
今天在写一个简单的springMVC的表单请求处理时,出现了这个问题.我的form表单用的是post方法提交,并没有使用get方法,出现这个问题时,笔者可谓是一脸懵逼. 这是form表单: 这是对po ...
- SpringMVC框架出现 405 request method post not supported 的解决方法
在SpringMVC框架中当使用post请求服务,然后请求成功转到一个静态文件,如html,htm等网页时.页面出现405 request method post not supported错误,只要 ...
- Spring MVC出现POST 400 Bad Request &405 Request method 'GET' not supported
首先描述一下出现错误的情景: 我刚学springmvc,想做一个登录界面的东西.然后试着写了一个controller如下: @RequestMapping(value = "/login&q ...
- tomcat报错HTTP Status 405 - HTTP method GET is not supported by this URL
servlet提交表单,结果出错. 出现HTTP Status 405 - HTTP method GET is not supported by this URL 原因是:1.继承自Httpserv ...
- 使用springmvc时报错HTTP Status 400 -
这个错误大多是因为,jsp的form表单提交的字段类型和后台接收字段类型不匹配造成的(例如,form中为String,后台接收为Integer). 我这里就是jsp表单中的日期数据没有写明类型,然后用 ...
- WARN PageNotFound:208 - Request method 'POST' not supported
在地址栏输入网址访问页面 ,用的是GET方法. 在用ajax接收后台数据,根据返回值进行提示或页面跳转时报:WARN PageNotFound:208 - Request method 'POST' ...
随机推荐
- NW.js 入坑指南
NW.js是什么? NW.js 是基于 Chromium 和 Node.js 运行的, 以前也叫nodeWebkit.这就给了你使用HTML和JavaScript来制作桌面应用的可能.在应用里你可以直 ...
- HTTP协议及其POST与GET操作差异 & C#中如何使用POST、GET等
转自: http://www.cnblogs.com/skynet/archive/2010/05/18/1738301.html 引言 HTTP协议我想任何IT人士都耳熟能详了,大家都能说出个所以然 ...
- Learning PHP Design Patterns
Learning PHP Design Patterns CHAPTER 1 Algorithms handle speed of operations, and design patterns ha ...
- GetWindowThreadProcessId
函数功能:该函数返回创建指定窗口线程的标识和创建窗口的进程的标识符,后一项是可选的. 函数原型:DWORD GetWindowThreadProcessld(HWND hwnd,LPDWORD lpd ...
- Java 之网络编程
网络模型 OSI 模型, 把网络通信的工作分为七层. TCP/IP 模型, 把网络通信的工作分为四层 应用层 传输层 网际层 主机至网络层 网络通信要素 (java.net 包) - IP 地址 (I ...
- windows7上使用docker容器
1.安装 下载DockerToolbox,并安装. 下载地址:https://dn-dao-github-irror.daocloud.io/docker/toolbox/releases/downl ...
- 3.Write Scripts for the mongo Shell-官方文档摘录
总结 1 使用js进行获取数据的方法 2 js方式和原生mongo shell的交互方式的区别写法 3 需要将所有数据打印出来使用到的循环示例 cursor = db.collection.find( ...
- git学习------>写给 Git 初学者的7个建议
PS:本文转载于(http://blog.jobbole.com/50603/),本文由 伯乐在线 - 吴鹏煜 翻译. 英文出处:(http://sixrevisions.com/web-develo ...
- <context-param>与<init-param>的差别与作用
<context-param>的作用: web.xml的配置中<context-param>配置作用 1. 启动一个WEB项目的时候,容器(如:Tomcat)会去读它的配置文件 ...
- 初识ambari
本文地址:http://www.cnblogs.com/qiaoyihang/p/6290467.html 引用:http://blog.csdn.net/yeruby/article/details ...