<table width="100%" border="1">
<#list agentList as res>
<#if res_index%2=1>
<tr class="even">
<#else>
<tr class="old">
</#if>
<td>${res.id} </td>
<td>${res.agName} </td>
<td><a href="','确定删除吗?');" class="a4font">修改代理等级</a></td>
</tr>
</#list>
</table>
使用res作为从后台接收到的agentList的别名,使用<#list>标签遍历,遍历时可以使用每遍历一次更换一下<tr>标签的class来实现.这其中需要使用Freemarker的内置_index来获取list的下标作为判断的参数