I have a problem mixing JSP Servlet and c:forEach form... The problem is that whatever my id is, the HTML form will always send the first in the list, refered to ' name="id" '. Is there a solution maybe to get several name="id1", name="id2" ...etc in order to get the good one ?
Here is the code.
<div id="client-table">
<form action="gestion-commandes" method="POST">
<table class="table table-striped">
<thead class="thead-custom">
<tr>
<th scope="col">#</th>
<th scope="col">NOM</th>
<th scope="col">PRENOM</th>
<th scope="col">EMAIL</th>
<th scope="col">TEL</th>
<th scope="col">COMMANDES</th>
</tr>
</thead>
<tbody class="tbody-custom">
<c:forEach items="${clients}" var="client">
<tr>
<th scope="col">${client.id}<input name="id" value="${client.id}" hidden = "true"></th>
<th scope="col">${client.nom}</th>
<th scope="col">${client.prenom}</th>
<th scope="col">${client.email}</th>
<th scope="col">${client.tel}</th>
<th scope="col"><button type="submit">Commandes</button>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</form>
</div>
</div>
Thank you in advance, Joss