从jsp访问按钮
我从数据库获取值,并在 while 循环中编写以下代码,该代码写在表单内,并在操作中调用另一个 jsp 页面,
<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" />
因此我将获得几行和相应的按钮。现在我的要求是,当我单击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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要么给按钮一个特定的名称,以便您可以检查其请求参数是否不返回
null
(麻烦),或者只是输入每行都有自己的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).