对于表单提交,tomcat默认只解析POST的表单,对于PUT和DELETE的不处理,所以Spring拿不到。
解决方案:1、修改tomcat的server.xml:

 
<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000"
           redirectPort="8443"
           parseBodyMethods="POST,PUT,DELETE"
           URIEncoding="UTF-8" />

解决方案2、在web.xml中添加HttpPutFormContentFilter

    <!--Servlet不支持PUT表单,需要Spring支持-->
    <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>

相关文章:

  • 2021-05-09
  • 2021-06-25
  • 2022-01-10
  • 2021-08-29
  • 2022-12-23
  • 2021-05-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案