如何发送 put 和 delete 请求
(1). 需要配置 HiddenHttpMethodFilter
(2). 需要发送 POST 请求
(3). 需要在发送 POST 请求时携带一个 name="_method" 的隐藏域, 值为 DELETE 或 PUT
<form action="SpringAnnotation/testRest/1" method="post">
<input type="hidden" name="_method" value="DELETE"/>
<input type="submit" value="TestRestDelete"/>
</form>
<form action="SpringAnnotation/testRest/1" method="post">
<input type="hidden" name="_method" value="PUT"/>
<input type="submit" value="TestRestPut"/>
</form>
在web.xml中配置 :
HiddenHttpMethodFilter
org.springframework.web.filter.HiddenHttpMethodFilter
HiddenHttpMethodFilter
/*