當前位置:成語大全網 - 新華字典 - forEach 怎麽遍歷兩個list

forEach 怎麽遍歷兩個list

forEach 遍歷兩個list方法:

<c:forEach items="${tempList}" var="temp" varStatus="loop">

<tr>

<td>${temp.id}</td>

<td>${temp.zdzName}</td>

<td>${temp.ztempString}</td>

<td>${rainList[loop.count-1].hourrf}</td>

<td><fmt:formatDate value="${temp.zdzdatetime}" pattern="yyyy-MM-dd HH:mm:ss"/> </td>

</tr>

</c:forEach>

在壹個table中同時顯示兩個list的內容,找了幾天終於找到解決辦法了,這裏的tempList和rainList是從後臺傳遞過來的list集合,網上有人說把兩個list分開遍歷,但是並不方便,同時也不符合我的要求。