请原谅我的英语不好。
最近我在JSP中创建了一个表来显示我从servlet发出的请求的输出。 servlet 将列表传递给 JSP 包含 3 个字段:日期、Revcode 和 1 个月的金额,并按日期分组。
下面是我想做的显示:
date | revcode | revcode | revcode and so on | total
2013-02-02 | amount | amount | amount and so on | sum of the amount for that day
这是我的代码:
<table class="table table-bordered table-striped table-hover">
<thead>
<th> Date </th>
<c:forEach var="revcodes" items="${revcodeList}">
<th>${revcodes.revcode}</th>
</c:forEach>
<!--<th> Total </th>-->
</thead>
<tr>
<td></td>
<c:forEach var="revcodeAmount" items="${revcodeList}">
<td>${revcodeAmount.amount}</td>
</c:forEach>
</tr>
</table>
我不知道如何创建一个表格,就像我上面想要的那样。 你们能指出我正确的方向吗? 或者我需要使用其他开源 API 作为表格记录,如 Jasper 报告来执行此操作?
这是我的截图链接:http://postimg.org/image/62ajljtcn/
我认为它可以工作:
<table class="table table-bordered table-striped table-hover">
<thead>
<th> Date </th>
<th> Total </th>
</thead>
<c:forEach var="revcodes" items="${revcodeList}">
<tr>
<td>${revcodes.revcode}</td>
<td>${revcodeAmount.amount}</td>
</tr>
</c:forEach>
</table>
您还可以使用 DisplayTag 此库帮助您显示表格数据以及聚合,并具有导出数据的选项。