【发布时间】:2016-09-24 17:00:30
【问题描述】:
我有一个表格,您可以在其中单击 addRowButton 时添加一行。这是它的代码:
$('#addRowButton').click(function () {
$('#data').append(
'<tr>' +
'<td>IGA01</td>' +
'<td>' +
'<div class="col-sm-10">' +
'<input type="text" name="description" class="form-control no-border" id="description" placeholder="Enter Institutional Graduate Attribute">' +
'</div>' +
'</td>' +
'<td>' +
'<div class="col-sm-10">' +
'<input type="text" name="remarks" class="form-control no-border" id="remarks">' +
'</div>' +
'</td>' +
'<td>' +
'<button type="button" class="btn btn-success btn-xs"><i class="fa fa-edit"> </i></button>' +
'<button type="button" id="deleteRow" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></button>' +
'</td>' +
'</tr>'
);
我的问题是当我尝试检索添加的行的值时,我无法获取它们。我只能检索未动态添加的行的值。 .这是 servlet 的代码(for 循环是让我查看 servlet 是否能够检索输入):
String[] codeIGA = request.getParameterValues("codeIGA");
String[] description = request.getParameterValues("description");
String[] remarks = request.getParameterValues("remarks");
for (int y = 0; y < codeIGA.length; y++) {
System.out.println("codeIGA: " + codeIGA[y]);
System.out.println("description: " + description[y]);
System.out.println("remarks: " + remarks[y]);
}
【问题讨论】:
标签: jquery jsp servlets dynamic html-table