SpringBoot如何使用PUT、DELETE请求方式

SpringBoot 2.2.X默认不支持put,delete等请求方式的。

首先需要在配置文件中打开他们,代码如下:

spring.mvc.hiddenmethod.filter.enabled=true

然后在form标签里面声明method为post

最后在form里面使用以下标签

<input th:type="hidden" name="_method" value="put">

name必须为“_method”,value值就是你想使用的请求方式,put或者delete等

posted @ 2019-12-24 08:50  LingBrown  阅读(4229)  评论(1编辑  收藏  举报