SpringBoot PUT请求

(1)配置HiddenHttpMethodFilter(SpringMVC需要配置,SpringBoot已经为我们自动配置了)

(2)在视图页面创建一个Post Form表单,在表单中创建一个input项,type="hidden" name="_method",value属性值为请求方式

 1 <!DOCTYPE html>
 2 <html lang="en" xmlns:th="http://www.thymeleaf.org">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>登陆</title>
 6 </head>
 7 <body>
 8     <form method="post" th:action="@{/user/login}">
 9         <input type="hidden" name="_method" value="put"/>
10         <input type="submit" value="登陆"/>
11     </form>
12 </body>
13 </html>

猜你喜欢

转载自www.cnblogs.com/fanqisoft/p/10324729.html