Reputation: 181
I have a table filled with data from database, now I'm working on a method that deletes a row by giving its id:
@RequestMapping(value= "/appel/delete/{id}", method = RequestMethod.GET)
public String delete(@PathVariable("id") Long id ) {
appelService.deleteAppel(id);
return ("index");
}
the thymeleaf table is this:
<tbody>
<tr th:each="appel : ${list}">
<td th:text="${appel.id}"></td>
<td th:text="${appel.serviceCode}"></td>
<td th:text="${appel.description}"></td>
<td th:text="${appel.answer}"></td>
<td><a href="">Update</a></td>
<td><a th:href="@{'/appel/delete/' + appel.id}">Delete</a></td>
</tr>
</tbody>
Every time I click on the delete link I get this message:
I don't understand where the error is and what could I change.
Upvotes: 0
Views: 941
Reputation: 10679
It's seems to be a problem with the string concatenation in theth:href
, try with something like this instead.
<td><a th:href="@{/appel/delete/{id}(id=${appel.id})}" >Delete</a></td>
Upvotes: 1