Struts2 循环编辑指定次数
<s:param name="first" value= "0" />
<s:param name="last" value= "10" />
<s:iterator>
counter:<s:property value="current-1" />
</s:iterator>
</s:bean>
其中first属性指定循环起始值,last指定循环终止值,其它相关属性可以查看org.apache.struts2.util.Counter类源码。
在下面迭代器中输入循环的当前值,即:current-1
实际例子
<s:param name="first" value="0" />
<s:param name="last" value="6" />
<s:iterator>
<s:iterator value="%{billData.billDtl}" id='vo' status='st'>
<s:if test="#st.count eq #counter.current">
<tr>
<td>${vo.invName}</td>
<td>${vo.tcBreedName}</td>
<td>${vo.tcGradeName}</td>
<td>${vo.tcLocName}</td>
<td>${vo.tcYear}</td>
<td>${tobacSpecMap[vo.specCd]}</td>
<td>${specFlagMap[vo.specFlg]}</td>
<td>${vo.sendQty}</td>
<td>${vo.realQty}</td>
<td>${vo.realQty - vo.sendQty}</td>
<td>${vo.realWgt}</td>
<td>${vo.checkQty}</td>
<s:if test="#st.count == 1">
<td rowspan="8">${billData.billEntity.remark}</td>
</s:if>
</tr>
</s:if>
</s:iterator>
<s:if test="%{current > billData.billDtl.size}">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<s:if test="current == 1">
<td rowspan="8" > </td>
</s:if>
</tr>
</s:if>
</s:iterator>
</s:bean>
<tr>
<td colspan="7" style="text-align: left;"><label>合计:<label></td>
<td>${billData.billContent['totalSendQty']}</td>
<td>${billData.billContent['totalRealQty']}</td>
<td>${billData.billContent['totalIntQty']}</td>
<td>${billData.billContent['totalWgt']}</td>
<td>${billData.billContent['totalCheckQty']}</td>
</tr>
</tbody>
</table>