Delete or put methods in thymeleaf

后端 未结 5 913
情歌与酒
情歌与酒 2021-02-05 15:52

I would like to call @RequestMapping(value = \"\", method = RequestMethod.DELETE) in spring from thymeleaf form.

Is there any possibility to call delete or

5条回答
  •  梦谈多话
    2021-02-05 16:55

    Thymeleaf is an HTML template engine. HTML does not support put or delete HTTP methods for its method 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 a hidden _method=put element as described here. Something like

    
    

提交回复
热议问题