title: Multiple values for same session variable in jsp
body: <p>My code generates a table, for every row an update and delete buttons are generated. When either update or delete buttons are pressed the relative row's number is supposed to be saved as a session variable but instead only the last row's number is saved. this method works in php though. I tried to assign session variables though the "onclick"attribute in html but it does not work either.I understand why and am trying to figure out a way around it.  </p>
  
  <pre><code>    &lt;%
              while(result.next()){
      %&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;%out.print("&lt;p&gt;"+result.getInt(1)+"&lt;/p&gt;"); %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%out.print("&lt;p&gt;"+result.getString(2)+"&lt;/p&gt;"); %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%out.print("&lt;p&gt;"+result.getString(3)+"&lt;/p&gt;"); %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%out.print("&lt;p&gt;"+result.getString(4)+"&lt;/p&gt;"); %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%out.print("&lt;p&gt;"+result.getString(5)+"&lt;/p&gt;"); %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%out.print("&lt;p&gt;"+result.getInt(6)+"&lt;/p&gt;"); %&gt;&lt;/td&gt;
              &lt;td&gt;
                  &lt;form action="DeleteUserServlet" method="POST"&gt;
                  &lt;input type="submit" value="Delete" 
                  onclick="&lt;%session.setAttribute("id",result.getInt(1));%&gt;"&gt;
                  &lt;/form&gt;                     
                  &lt;form action="UpdateUser.jsp" method="POST"&gt;
                  &lt;input type="submit" value="Update" onclick="
                  &lt;%session.setAttribute("id",result.getInt(1));%&gt;"&gt;
                  &lt;/form&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;%
          }
      %&gt;
  </code></pre>