表格处理数据时候,可能会遇到多列数据参数绑定才多个List上,此时就需要遍历多个List或者JSONArray,以下解决方案为我最终采用的方式
1.引入C标签
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2.处理方案
<c:forEach items="${infoList}" var="info" varStatus="loop">
<tr>
<td>${info.id}</td>
<td>${info.zdzName}</td>
<td>${info.ztempString}</td>
<td>${userNames[loop.count-1].name}</td>
</tr>
</c:forEach>
说明:其中infoList和userNames是控制器传过来的list集合,<td>${userNames[loop.count-1].name}</td>中name是userNames对应的集合存储的对象类型的属性,如果userNames集合存储的是String,可以直接使用<td>${userNames[loop.count-1]}</td>