I would like to call @RequestMapping(value = "", method = RequestMethod.DELETE)
in spring from thymeleaf form.
Is there any possibility to call delete or put request mapping methods from thymeleaf?
please give your suggestion on this.
I would like to call @RequestMapping(value = "", method = RequestMethod.DELETE)
in spring from thymeleaf form.
Is there any possibility to call delete or put request mapping methods from thymeleaf?
please give your suggestion on this.
Thymeleaf is an HTML template engine. HTML does not support
put
ordelete
HTTP methods for itsmethod
attribute. So, no, you can't. However, you have alternatives.You can use javascript to send the request asynchronously. In that case, you can send any type of HTTP request.
You can also use a
HiddenHttpMethodFilter
with ahidden
_method=put
<input>
element as described here. Something likeOnly solution I've found - use js:
Add scrypt:
and add calling link (or change to button):
You could use
th:method
for this:This will generate a hidden input element, which will be picked up by Spring MVC: