今天写程序时才发现,<logic:iterate>两层循环,如果内层类型是Iterator时,内层只循环一次,而如果内层类型为List、Vector之类的则可多次循环。
如:
<logic:iterate name="departments" id="department" >
<bean:write name="department" property="name"/>(<bean:write name="department" property="id"/>)
<logic:iterate name="users" id="user" indexId="index">
<bean:define id="departmentId" name="user" property="departmentId"/>
<logic:equal name="department" property="id" value="<%=String.valueOf(departmentId)%>" >
<bean:write name="user" property="name"/>(<bean:write name="user" property="id"/>)
</logic:equal>
</logic:iterate>
</logic:iterate>
显示各部门下的人时,<logic:iterate name="users" id="user" indexId="index">的users就需要是List、Vector之类类型的,否则死活都匹配不上