在百里香叶中删除或放置方法 [英] Delete or put methods in thymeleaf

查看:33
本文介绍了在百里香叶中删除或放置方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在春天从百里香叶形式调用 @RequestMapping(value = "", method = RequestMethod.DELETE).

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

有没有可能从 thymeleaf 调用 delete 或 put 请求映射方法?

Is there any possibility to call delete or put request mapping methods from thymeleaf?

请就此提出您的建议.

推荐答案

你可以使用 th:method :

<form th:object="${commandObject}" th:action="@{/urlToCall}" th:method="delete">

这将生成一个隐藏的输入元素,它将被 Spring MVC 拾取:

This will generate a hidden input element, which will be picked up by Spring MVC:

<input type="hidden" name="_method" value="delete">

这篇关于在百里香叶中删除或放置方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆