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等

猜你喜欢

转载自www.cnblogs.com/lbhym/p/12089549.html