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的更多相关文章

  1. Restful风格,PUT修改功能请求,表单中存在文件报错-HTTP Status 405 - Request method 'POST' not supported

    解决方案配置如下 <!-- 配置文件上传解析器 --> <bean id="multipartResolver" class="org.springfr ...

  2. 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, ...

  3. HTTP Status 405 - Request method 'GET' not supported?(尚硅谷Restful案例练习关于Delete方法出现的错误)

    哈罗大家好,最近在如火如荼的学习java开发----Spring系列框架,当学习到SpringMVC,动手实践RESTFUL案例时,发现了以上报错405,get请求方法没有被支持. 首先第一步,我查看 ...

  4. springMVC出现HTTP Status 405 - Request method 'GET' not supported错误的解决方法

    今天在写一个简单的springMVC的表单请求处理时,出现了这个问题.我的form表单用的是post方法提交,并没有使用get方法,出现这个问题时,笔者可谓是一脸懵逼. 这是form表单: 这是对po ...

  5. SpringMVC框架出现 405 request method post not supported 的解决方法

    在SpringMVC框架中当使用post请求服务,然后请求成功转到一个静态文件,如html,htm等网页时.页面出现405 request method post not supported错误,只要 ...

  6. Spring MVC出现POST 400 Bad Request &405 Request method 'GET' not supported

    首先描述一下出现错误的情景: 我刚学springmvc,想做一个登录界面的东西.然后试着写了一个controller如下: @RequestMapping(value = "/login&q ...

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

  8. 使用springmvc时报错HTTP Status 400 -

    这个错误大多是因为,jsp的form表单提交的字段类型和后台接收字段类型不匹配造成的(例如,form中为String,后台接收为Integer). 我这里就是jsp表单中的日期数据没有写明类型,然后用 ...

  9. WARN PageNotFound:208 - Request method 'POST' not supported

    在地址栏输入网址访问页面 ,用的是GET方法. 在用ajax接收后台数据,根据返回值进行提示或页面跳转时报:WARN PageNotFound:208 - Request method 'POST' ...

随机推荐

  1. 并发编程5 操作系统&进程

    一.今日大纲 1.multiprocessing模块简单应用 2.for循环创建进程 3.进程传参方式和创建方式2 4.join方法 5.操作系统基础 二.今日内容 (1)操作系统简单介绍 多道技术: ...

  2. 淘宝订单数据转CSV

    <html> <body> <div id="result"> </div> <div> <textarea st ...

  3. Android 中 js 和 原生交互

    Android中的WebView 中加载的URL 默认是在手机浏览器中加载的,我们可以覆盖这种默认的动作,让网页在WebView中打开.通过设置WebView的WebViewClent 达到这个效果. ...

  4. Spring 框架的核心功能之AOP技术

    1. AOP 的概述 AOP, Aspect Oriented Programming, 面向切面编程; 通过预编译方式和运行期动态代理实现程序功能的统一维护的技术; AOP 采取横向抽取机制,取代了 ...

  5. how to deal with ^M in linux

    change windows file to linux file dos2unix configure https://blog.csdn.net/xiongmaojiayou/article/de ...

  6. mysql 建立表之间关系 一对一 练习2

    创建db5数据库 create database db5 charset=utf8; use db5; 例二:一个管理员唯一对应一个用户 用户表: id user password 1 egon xx ...

  7. leetcode -day 15 Distinct Subsequences

    1.  Distinct Subsequences  Given a string S and a string T, count the number of distinct subsequen ...

  8. Mysql学习笔记—视图

    1.什么是视图 视图(View)是一种虚拟存在的表.其内容与真实的表相似,包含一系列带有名称的列和行数据.但是视图并不在数据库中以存储的数据的形式存在.行和列的数据来自定义视图时查询所引用的基本表,并 ...

  9. Ubuntu学习笔记1-基本部分

    Vim相当于vi的升级版 Find p*.txt支持查找通配符 Echo 回显命令 echo hello  >1.txt  追加命令,不覆盖 echo hello  >1.txt  覆盖命 ...

  10. Delphi 正则表达式之TPerlRegEx 类的属性与方法(7): Split 函数

    Delphi 正则表达式之TPerlRegEx 类的属性与方法(7): Split 函数 //字符串分割: Split var   reg: TPerlRegEx;   List: TStrings; ...