[英]Retrieving Array of Objects Sent Using AJAX in JSP
With respect to this question pass array of objects to jsp , how do you retrieve the results in JSP? 关于将对象传递给jsp的问题 ,如何在JSP中检索结果?
The question is, I have this in my Javascript: 问题是,我的Javascript中包含以下内容:
data = [
{
id: "333",
date: "22/12/2015"
},
{
id: "333",
date: "22/12/2015"
}]
$.post(eval.jsp, {data:data}, function(){}, "json");
How do i recover data in eval.jsp. 我如何在eval.jsp中恢复数据。 I tried
我试过了
request.getParameterValues("data");
But the value returned is null
. 但是返回的值为
null
。 This is not the value passed of course as can be seen in the headers (using Chrome). 当然,这不是传递的值,可以在标题中看到(使用Chrome)。
You can use a dynamic table or Foreach to show data in it . 您可以使用动态表或Foreach在其中显示数据。 Example:
例:
<table id="allStudent" class="table table-bordered">
<thead>
<tr>
<th>FirstName</th>
<th>LastName</th>
<th>studentCode</th>
<th>Major</th>
<th>FatherName</th>
<th>id</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tmplBody">
<script id="scriptTmp">
<tr id="deleteTr" >
<td>
${firstName}
<td>
${lastName}
</td>
<td>
${studentCode}
</td>
<td>
${major}
</td>
<td>
${fatherName}
</td>
<td>
${id}
</td>
<td>
<button id="updateStudent" class="btn btn-success"><i class="fa fa-pencil" style="padding-right: 10px;"></i>
Update
</button>
<a href="#" type="button" class="btn btn-danger deletebtn" role="button" onclick="deleteSt(${id})"><i class="fa fa-trash" style="padding-right: 10px;"></i>
Delete
</a>
<button class="btn btn-info" role="button"><i class="fa fa-check" style="padding-right: 10px;"></i>Course
Selection
</button>
</td>
</tr>
</script>
</tbody>
</table>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.