(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>