I have to send two data from thymeleaf
to controller
like this in a th:href
:
<table id="itemTable" class="deneme">
<tbody>
<tr th:each="item : ${list.items}">
<td>
<p th:text="${item.content}"/>
<a th:href="@{/deleteItem/{listId}(listId=${list.id})/{itemId}(itemId=${item.id})}">
<span>Delete</span>
</a>
</td>
</tr>
</tbody>
</table>
The controller is:
@RequestMapping("/deleteItem/{listId}/{itemId}")
public String deleteItem(Model model, @PathVariable(value = "listId") Integer listId, @PathVariable(value = "itemId") int itemId) {
...
return "list";
}
itemId
is coming with the true value but listId
is coming as {listId}(listId=${toDoList.id})
What is the problem exactly? Please help me!
The syntax for multiple parameters looks like this:
<a th:href="@{/deleteItem/{listId}/{itemId}(listId=${list.id},itemId=${item.id})}"><span>Delete</span></a>