Spring 3 MVC supports all 4 of RESTful methods: GET, POST, PUT and DELETE. But does its view technology support them on forms? If not, what is the real use of method
attribute in form:form
tag?
I tried to use PUT method on the form:
<form:form action="/myaction" method="PUT">
...
</form:form>
Generated HTML was:
<form id="command" action="/myaction" method="post">
<input type="hidden" name="_method" value="PUT"/>
...
</form>
It is clear since most browsers don't support other methods besides GET and POST. But Spring can handle it with additional input
with name _method
and value METHOD_NAME
. Does it?
When I send specified form to a controller method annotated with
@RequestMapping(method=RequestMethod.PUT)
it claims, that request method POST
is not supported. But why POST
and not PUT
? What actually happens under the hoods?