需要在web.xml设置过滤器
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>
此外还需要在请求表单中携带_method 当 _method值为 PUT 时 发送put请求
<%@ page contentType="text/html;charaset=UTF-8" language="java" %>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="/user" method="post">
<input type="hidden" name="_method" value="PUT">
<input type="submit" value="提交">
</form>
</body>
</html>
|