使用复选框发送多个值
您好,我创建了一个表,其中一个表列是一个复选框和其他数据 现在我知道如何使用复选框发布单个值 bt 如何发送整行 即当用户选中复选框 id、标题、描述......请求数量被发布到 servlet
<table border="1" cellpadding="6" cellspacing="4"
style="border-collapse: collapse" width="200%" id="AutoNumber1"
align="center" bordercolorlight="#800000" bordercolordark="#800000 " class="left" >
<tr>
<td width="5%" align="center">
<input type="checkbox" id=checked" value=<%= id%>/>
<font face="Arial" size="3" color="light blue">
Options</font>
</td>
<td width="15%" align="center">
<font face="Arial" size="3" color="light blue">
Title</font>
</td>
<td width="40%" align="center">
<font face="Arial" size="3" color="light blue">
Description</font>
</td>
<td width="15%" align="center">
<font face="Arial" size="3" color="light blue">
Company</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
Province</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
District</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
Actual Quantity</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
Required Quantity</font>
</td>
</tr>
</table>
hi i have created a table one of the table columns is a check box and other data
now i know how i can post a single value with a check box bt how can i send an entire row
i.e. when the user checks the check box id,title,description.......req quantity gets posted to the servlet
<table border="1" cellpadding="6" cellspacing="4"
style="border-collapse: collapse" width="200%" id="AutoNumber1"
align="center" bordercolorlight="#800000" bordercolordark="#800000 " class="left" >
<tr>
<td width="5%" align="center">
<input type="checkbox" id=checked" value=<%= id%>/>
<font face="Arial" size="3" color="light blue">
Options</font>
</td>
<td width="15%" align="center">
<font face="Arial" size="3" color="light blue">
Title</font>
</td>
<td width="40%" align="center">
<font face="Arial" size="3" color="light blue">
Description</font>
</td>
<td width="15%" align="center">
<font face="Arial" size="3" color="light blue">
Company</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
Province</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
District</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
Actual Quantity</font>
</td>
<td width="10%" align="center">
<font face="Arial" size="3" color="light blue">
Required Quantity</font>
</td>
</tr>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 servlet 中检查选中了哪个复选框,并根据该复选框处理所有其他数据。例如,如果您的 HTML 如下所示:
在您的 servlet 中,检查
checkbox_1
是否被选中?如果是,则处理title_1
和description_1
。并对checkbox_2
、title_2
和title_2
应用相同的逻辑。description_2
in your servlet check which
checkbox
are selected and depending upon that process all other data. e.g, if your HTML looks like this:than in your servlet, check whether
checkbox_1
is selected? if yes than processtitle_1
anddescription_1
. And apply same logic forcheckbox_2
,title_2
&description_2