title: Servlets-JSP: How to put a delete-modify button for every row of HTML table!
body: <p>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.</p>
  
  <pre><code>&lt;%  if (listx.size() &gt; 0)
      {
          int j = 0;
          for (int i = 0; i &lt; listx.size(); i++)
          {
              Contact x= listx.get(i);
  %&gt;
  &lt;form action="servl" method="get"&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%=++j%&gt;            &lt;/td&gt;
          &lt;td&gt;&lt;%=x.getName()%&gt;            &lt;/td&gt;
          &lt;td&gt;&lt;%=x.getCar()%&gt;            &lt;/td&gt;
          &lt;td&gt;&lt;%=x.getZip()%&gt;            &lt;/td&gt;
  
          &lt;td&gt;
              &lt;input type="hidden" name="ID" value="&lt;%=x.getId()%&gt;"&gt;
              &lt;input type="submit" name="action" value="modify"&gt;
              &lt;input type="submit" name="action" value="delete"&lt;/td&gt;
      &lt;/tr&gt;
  &lt;%
      } %&gt;
  </code></pre>
  
  <p>P.S. 1. This could be a solution: <a href="http://www.daniweb.com/forums/post983361.html#post983361" rel="nofollow noreferrer">http://www.daniweb.com/forums/post983361.html#post983361</a> (post 10) but I need that my inputs to be in this format:</p>
  
  <pre><code>&lt;input type="submit" name="action" value="NameOfTheAction"&gt;
  </code></pre>
  
  <p>Later Edit: Don't say anything about the scriplets. I will use JSTL later. :)</p>
  
  <p><strong><em>Problem solved</em></strong>:  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. </p>