使用Struts的logic标签,遍历List时使用indeId来自动输出序号并加一
例子如下:
<table>
<tr>
<td>序号</td>
<td>姓名</td>
...
</tr>
<logic:present name="targetbean">
<logic:iterate name='helperbean' id='helperbean' type='net.echochina.HelperBean' scope='request' indexId="index">
<tr>
<td><%= index.intValue() + 1 %></td>
<td><bean:write name='helperbean' property='name' /></td>
.....
</tr>
</logic:iterate>
</logic:present>
</table>