I have a problem with this method, I need to update the value of the "procesado" variable (the variable it starts being from false because its boolean type), I can select one or more checkboxes and when I click the button(Procesar), the value of the variable should change to true.
the problem is when i select the checkboxes that i can't update and display the results
This is my controller:
@RequestMapping(value = "/consulta/{id}", method = RequestMethod.PUT)
public String update(@RequestBody Usuario user, @PathVariable(value="id") List<Usuario> id) {
if(id != null) {
for(Usuario idInt: id) {
Usuario idValor= idInt;
user.setProcesado(true);
iusuarioServices.save(user);
}
}
return "consulta";
}
This is my html
<form action="@{/consulta/{id}}">
<table>
<thead>
<tr>
<th>ID</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Procesado</th>
<th>Accion</th>
</tr>
</thead>
<tbody>
<tr th:each="usuarios: ${usuarios}">
<td th:text="${usuarios.id}"></td>
<td th:text="${usuarios.nombre}"></td>
<td th:text="${usuarios.apellido}"></td>
<td th:text="${usuarios.procesado}"></td>
<td><input type="checkbox" th:name="procesado" th:value="${usuarios.id}"></td>
</tr>
</tbody>
<tr>
<td><input type="submit" value="Procesar" /></td>
</tr>
</table>
</form>