[英]How to pass selected rows from a table as request parameters on form submit?
I,m developing a web app(jsp) that extracts some data from a .doc file. 我正在开发一个Web应用程序(jsp),可从.doc文件中提取一些数据。 Headings from an uploaded document is extracted and listed in a table as below.
提取了上载文档的标题,并在下表中列出。
Generated output on upload-screenshot 在上传屏幕截图上生成的输出
I have added a check-box for each row. 我为每行添加了一个复选框。 Next what I want to do is save the check-box checked rows into an xml.
接下来,我要做的是将复选框选中的行保存到xml中。 I know how to write xml but how to do it only with the checked rows on form submit?
我知道如何编写xml,但如何仅使用表单提交中的选中行来做到这一点? My question summery is, How can I pass those checked rows from table on form submit as request parameters.
我的问题总结是,如何将表单上表格中的那些选中的行作为请求参数传递。 Thanks in advance.
提前致谢。
Creating checkbox array by keeping same name for all checkboxes will give you what you want. 通过为所有复选框保留相同的名称来创建复选框数组,将为您提供所需的内容。 In java, after submitting your form you read it in your servlet as 'request.getParameterValues("checkboxname")'.
在Java中,提交表单后,您在servlet中将其读为“ request.getParameterValues(“ checkboxname”)”。 you will get checked checkboxes from the array returned.
您将从返回的数组中获得选中的复选框。
<table class="table">
<tr value="1" class="side-link">
<td>one</td>
<td>two</td>
</tr>
<tr value="2" class="side-link">
<td>one</td>
<td>two</td>
</tr>
</table>
$(".table").on('click','tr',function(e){
e.preventDefault();
var id = $(this).attr('value');
alert(id);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.