Spring Boot 表单无法发送PUT、DELETE请求

在表单中创建

<input type="hidden" name="_method" value="PUT" th:if="${emp!=null}">

  

后依旧无法发送PUT请求,原因是springBoot默认关闭了MVC的HiddenHttpMethodFilter,因此需要打开。

打开方式:在application.properties中添加:

# 开启mvc的HiddenHttpMethodFilter,以便可以表单可以发送PUT、DELETE等请求
spring.mvc.hiddenmethod.filter.enabled=true

原文地址:http:xiaoxiablogs.top/

 

posted @ 2019-10-29 20:16  xiaoxia0722  阅读(612)  评论(0)    收藏  举报