access buttons from jsp
i'm getting the value s from database and in while loop i'm writing the following code which is written inside a form and on action calls another jsp page
<TD> <%= set.getInt(1) %> </TD>
<TD><%= set.getString(2) %> </TD>
<TD><%= set.getString(3) %> </TD>
<TD> <%= set.getString(4) %> </TD>
<TD><%= set.getString(5) %> </TD>
<TD> <%
String s = set.getString(4);
if(s.equals("Request Recieved"))
{ %>
<input type="hidden" id= "i1" name="h1" value="Request Recieved" />
<input type="submit" id="i1" value="Submit" /> 开发者_运维问答
Thus i'll get a few rows and respective buttons. now my requirement is when i click a particular button on the jsp page only the value related to that button should only be updated to database. but i'm unable to relate the button with its respective value.
Either give the button a specific name, so that you can check if its request parameter doesn't return null
(cumbersome), or just put each row in its own <form>
where the row ID is set as hidden input value (recommended).
精彩评论