(1)配置HiddenHttpMethodFilter(SpringMVC需要配置,SpringBoot已经为我们自动配置了)
(2)在视图页面创建一个Post Form表单,在表单中创建一个input项,type=”hidden” name=”_method”,value属性值为请求方式
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>登陆</title>
</head>
<body>
<form method="post" th:action="@{/user/login}">
<input type="hidden" name="_method" value="put"/>
<input type="submit" value="登陆"/>
</form>
</body>
</html>