如何使用JSTL动态创建表?
我在SpringFramework中有MAP(ArrayList)对象
Map<String, ArrayList<TaxAllTotalChargeViewModel>> makeobjmap=new HashMap<String, ArrayList<TaxAllTotalChargeViewModel>>();
===&gt;这张地图的价值是↓↓↓↓↓↓
totalal3=[TaxAllTotalChargeViewModel [taxDetailId=0, dormId=3, dormName=Adorm, taxName=電気, taxFee=未登録],
TaxAllTotalChargeViewModel [taxDetailId=0, dormId=3, dormName=Adorm, taxName=インタネット, taxFee=未登録],
TaxAllTotalChargeViewModel [taxDetailId=0, dormId=3, dormName=Adorm, taxName=水道, taxFee=未登録],
TaxAllTotalChargeViewModel [taxDetailId=0, dormId=3, dormName=Adorm, taxName=ガス, taxFee=未登録]],
totalal2=[TaxAllTotalChargeViewModel [taxDetailId=2, dormId=2, dormName=Bdorm, taxName=電気, taxFee=4000],
TaxAllTotalChargeViewModel [taxDetailId=4, dormId=2, dormName=Bdorm, taxName=インタネット, taxFee=3000],
TaxAllTotalChargeViewModel [taxDetailId=6, dormId=2, dormName=Bdorm, taxName=水道, taxFee=3000],
TaxAllTotalChargeViewModel [taxDetailId=0, dormId=2, dormName=Bdorm, taxName=ガス, taxFee=未登録]],
totalal1=[TaxAllTotalChargeViewModel [taxDetailId=1, dormId=1, dormName=Cdorm, taxName=電気, taxFee=3000],
TaxAllTotalChargeViewModel [taxDetailId=3, dormId=1, dormName=Cdorm, taxName=インタネット, taxFee=2500],
TaxAllTotalChargeViewModel [taxDetailId=5, dormId=1, dormName=Cdorm, taxName=水道, taxFee=3000],
TaxAllTotalChargeViewModel [taxDetailId=7, dormId=1, dormName=Cdorm, taxName=ガス, taxFee=3000]]}
我想将Transpose垂直转换为Horizontal,每个类别都可以动态更改所以我尝试使每个类别的table对象 我把tham放在地图上。 为什么我使用Map&lt;&gt;接口,我需要在Java中创建变量和对象。
我想制作这张表格。
<!-- ★ This is what I want result through this logic
<tr>
<td>chargeMonth</td>
<td>dormitoryName</td>
<td>tax1_fee<i class="fa fa-trash-o " aria-hidden="true"></i> <i class="fa fa-wrench" aria-hidden="true"></i></td>
<td>tax2_fee <i class="fa fa-trash-o " aria-hidden="true"></i> <i class="fa fa-wrench" aria-hidden="true"></i></td>
<td>tax3_fee</td>
....(category can increase or decrease)
</tr>
<br>
<tr>
<br><td>9</td>
<td>dorm_A</td>
<td>1500 <i class="fa fa-trash-o " aria-hidden="true"></i> <i class="fa fa-wrench" aria-hidden="true"></i></td>
<td>1500 <i class="fa fa-trash-o " aria-hidden="true"></i> <i class="fa fa-wrench" aria-hidden="true"></i></td>
<td>2500 <i class="fa fa-trash-o " aria-hidden="true"></i> <i class="fa fa-wrench" aria-hidden="true"></i></td>
<td>not exist</td>
</tr>
-->
★每个循环是一个td标签:)当准备tr行中的每个td值时,我必须添加close tr标签。
<c:forEach items="${makeobjmap}" var="makeobjmap">
<c:forEach items="${makeobjmap.value}" var="totallist ">
<c:forEach items="${totallist}" var ="totalmodel" varStatus="status">
<c:if test="status.first">
<tr>
<td>${month}</td>
<td>${totalmodel.dormName}</td>
</c:if>
<td>${totalmodel.taxFee}
</td>
<c:if test="status.last">
</tr>
</c:if>
</c:forEach>
</c:forEach>
</c:forEach>
</tbody>
</table>
但所有数据都显示在一行中 重复12次...... :( 我认为$ {status.first}不是一个功能 我怎么修好它?