java Thymeleaf,无法访问该参数
我试图在thymeleaf中获得值以传递给delete方法,但我不能。请帮忙
我有一张这样的桌子,它在工作:
<tbody>
<tr th:each="tempCustomer : ${customer}">
<td th:text="${tempCustomer.ipsid}" />
<td th:text="${tempCustomer.docnumber}" />
<td th:text="${tempCustomer.fullname}" />
<td th:text="${tempCustomer.nickname}" />
<td th:text="${tempCustomer.gender}" />
<td th:text="${tempCustomer.placeofbirth}" />
<td th:text="${tempCustomer.fincode}" />
<td th:text="${tempCustomer.status}" />
</tr>
</tbody>
但我不知道如何通过这个客户。ipsid到以下删除方法链接中的id:
<form action="#" th:action="@{delete/id}">
<button type="submit" class="btn btn-primary btn-sm mb-3">Delete</button>
</form>
# 1 楼答案
你需要通过临时客户。在表单中按submit时的id。为此,您需要以如下形式添加输入:
然后在控制器中,它将如下所示: