如果直接发送ajax=put形式的请求
      是拿不到请求体中的数据的。
    
      Tomcat:
              1、将请求体中的数据,封装一个map
              2、request.getParameter("empName")就会从这个map中取值
              3、SpringMVC封装POJO对象的时候
                      会把POJO中每个属性的值,request.getParameter("email");
      AJAX发送PUT请求引发的血案:
              PUT请求:请求体中的数据,request.getParameter("empName")拿不到
              Tomcat一看是PUT请求不会封装请求体中的数据为map,只有POST形式的请求才封装请求体为map
    
      tomcat源码中

org.apache.catalina.connector.Request--parseParameters() (3000多行)

        protected String parseBodyMethods = "POST";
if ( !getConnector().isParseBodyMethod(getMethod())){
success = true;
return;
}

解决方法:

1.ajax请求发送post方法,请求路径中+上 &_Method = PUT 或者

2. 配置过滤器

   <filter>
<filter-name>HttpPutFormContentFilter</filter-name>
<filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HttpPutFormContentFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

最新文章

  1. 反编译.NET工程
  2. 廖雪峰js教程笔记14 file文件操作
  3. pycharm的安装
  4. Java多线程编程——进阶篇二
  5. Two classes have the same XML type name 排错【转】
  6. WPF 控件截图位置不正确的问题
  7. 搭建你的持续集成server - CruiseControl step by step(1)
  8. Uva 409-Excuses, Excuses!(串)
  9. Could not resolve view with name &#39;***&#39; in servlet with name &#39;dispatcher&#39;
  10. Java多线程(一) 什么是线程
  11. BZOJ4997 [Usaco2017 Feb]Why Did the Cow Cross the Road III
  12. 封装JedisClient.提供API实现对redis的操作
  13. SSM 后台封装的有值, 到前台打印的时候没有值
  14. js dom添加回车事件
  15. Linux内核中断处理体系分析
  16. C#中的抽象类与重写
  17. Python中的strip()的理解
  18. UNIX和linux系统性能监控工具oswatcher
  19. PTA L2-001 紧急救援-最短路(Dijkstra)多条最短路找最优解并输出路径 团体程序设计天梯赛-练习集
  20. springmvc中拦截器与springmvc全局异常处理器的问题

热门文章

  1. WebGL three.js学习笔记 使用粒子系统模拟时空隧道(虫洞)
  2. PHP全栈学习笔记12
  3. Vue 进阶之路(七)
  4. angular2-7中的变化监测
  5. Linux创建普通用户
  6. VSCode Python开发环境配置
  7. 兼容IE8浏览器移除class样式的方法
  8. Mac OS X中开启或关闭显示隐藏文件命令
  9. The specified type member &#39;Date&#39; is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
  10. Kafka系列2-producer和consumer报错