日期:2014-05-17 浏览次数:20728 次
ExtraFunction extra = null;
List<ExtraFunction> extraList = new ArrayList<ExtraFunction>();
for(Group group : groupList){
extra = extraService.getExtraFunctionByGroupId(group.getGroupId());
extraList.add(extra);
}
request.setAttribute("extraList", extraList);
...
<c:forEach var="group" items="${groupList}" varStatus="st">
<c:forEach var="extra" items="${extraList}" varStatus="st1">
<c:if test="${st.index==st1.index}">
...//只有当两个list的下标都一样的时候,再去循环。
</c:if>
</c:forEach>
</c:forEach>
ExtraFunction extra = null;
List<Object[]> groupDetails = new ArrayList<Object[]>();
for(Group group : groupList){
Object[] unitArray = new Object[2];
unitArray[0] = group;
unitArray[1] = extraService.getExtraFunctionByGroupId(group.getGroupId());
groupDetails.add(unitArray);
}
request.setAttribute("groupDetails", groupDetails);
...
<c:forEach var="group" items="${groupDetails}" varStatus="st">
<c:if test="${group[1].isPublic == 1 && group[0].status == 1}"><c:if>
...
<c:forEach var="group" items="${groupList}" varStatus="st">
...
<a href="<c:if test="${extraMap[st.index].isPublic == 1 && group.status == 1}">
...