I'm trying to add to every row of a HTML table a "delete" and a "modify" button. If I use this method, the value of the "id" is alawys the value of id from the first row, even if I pressed the button from the rows 2-n.
<% if (listx.size() > 0)
{
int j = 0;
for (int i = 0; i < listx.size(); i++)
{
Contact x= listx.get(i);
%>
<form action="servl" method="get">
<tr>
<td><%=++j%> </td>
<td><%=x.getName()%> </td>
<td><%=x.getCar()%> </td>
<td><%=x.getZip()%> </td>
<td>
<input type="hidden" name="ID" value="<%=x.getId()%>">
<input type="submit" name="action" value="modify">
<input type="submit" name="action" value="delete"</td>
</tr>
<%
} %>
P.S. 1. This could be a solution: http://www.daniweb.com/forums/post983361.html#post983361 (post 10) but I need that my inputs to be in this format:
<input type="submit" name="action" value="NameOfTheAction">
Later Edit: Don't say anything about the scriplets. I will use JSTL later. :)
Problem solved: I found out the problem. I didn't closed the form tag for every row. I closed the tag only at the finish of the table (creating a form for the whole table), so every time I pressed a row button, every "id" was send.