首页 > 代码库 > c:forEach实现换行

c:forEach实现换行

Map<String,String> map = new TreeMap<String,String>();  
map.put("key1", "value1");  
map.put("key2", "value2");  
map.put("key3", "value3");  
map.put("key4", "value4");  
map.put("key5", "value5");  
map.put("key6", "value6");  
map.put("key7", "value7");  
request.setAttribute("map", map);  
<tr>  
    <c:forEach items="${map}" var="note" varStatus="status">  
        <c:if test="${status.index%2==0}">  
            </tr>  
            <tr>  
        </c:if>  
        <td>${note.key }</td>  
        <td>${note.value }</td>           
    </c:forEach>  
</tr> 

 

c:forEach实现换行