How to invoke RESTful services from HTML forms?
We're using Grails for building RESTful services which we'll call from browser clients using HTML forms, the problem is that forms only support GET and POST, so we're not sure how开发者_开发百科 to handle PUT and DELETE.
Grails template tags can help you there:
However, issuing a request with a method other than GET or POST from a regular browser is not possible without some help from Grails. When defining a form you can specify an alternative method such as DELETE:
<g:form controller="book" method="DELETE">
..
</g:form>
Grails will send a hidden parameter called _method, which will be used as the request's HTTP method. Another alternative for changing the method for non-browser clients is to use the X-HTTP-Method-Override to specify the alternative method name.
Via: http://www.grails.org/doc/latest/guide/13.%20Web%20Services.html
精彩评论