I'm completely editing the original question sience I've got an answer in this post that gave me some guidance:
I've got this ThymeLeaf template:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<link rel="stylesheet" th:href="@{/app.css}" />
</head>
<body>
<div class="container">
<select name="gustos" id="selectGustos">
<option th:each="gusto : ${gustos}" th:text="${gusto.nombre}" th:value="${gusto.id}"> </option>
</select>
<div class="row delete">
<div class="col s12 l8">
<form th:action="@{'/gustos/' + ${gusto.id} + '/delete'}" method="post">
<button type="submit" class="button">Borrar</button>
</form>
</div>
</div>
</div>
</body>
</html>
In the <form>
I'm doing a post with the variable ${gusto.id} that's not being binded to anything (and not working properly).
What I need to do is bind the selected <option>
's id value to the form's ${gusto.id} variable so that my controller then know's which id needs to be deleted.
So basically I need the selected <option>
's (which it will be an Object of type Gusto) id attribute to travel in my <form>
to my controller.
The controller is expecting an int as the id !!