I'm trying to create controller which will be responsible for deleting specific displayed users by sending their id in request that will be cougth by method and proceed. So far I wrote something like this:
@RequestMapping("delete/{user.id}")
public String deleteUser(@PathVariable("user.id") String userId)
{
userRepository.delete(Long.parseLong(userId));
return "panel";
}
And I also created a dinamic table in my thymyleaf template that displays all users.
<tr th:each="user : ${userList}">
<td th:text="${user.firstname}"></td>
<td th:text="${user.lastname}"></td>
<td th:text="${user.email}"></td>
<td th:text="${user.birthdate}"></td>
<td th:text="${user.password}"></td>
<td><a href="delete/${user.id}.html">Delete</a></td>
<td><a href="#">Edit</a></td>
</tr>
Unfortunatelly "delete/${user.id}.html" request doesn't work. Any sugestions?
Thank you in advance.