---
title: "c:forEach 遍历集合中的元素，判断是否是最后一个元素"
author: "yyjava"
date: "2014-06-25T17:45:00Z"
tags: []
slug: "c-foreach"
draft: false
lastmod: "2014-06-26T17:03:51Z"
id: 2085521
url: "https://yyjava.iteye.com/blog/2085521"
---

### c:forEach 遍历集合中的元素，判断是否是最后一个元素

**&lt;c:forEach items="${pointSection}" var="chl" varStatus="stat"&gt;**  
**&lt;c:if test="${!stat.last}" &gt;**  
&lt;div class="item" id="\_MYJD\_repair" style="border-bottom-style: dotted;border-bottom-width: 1px;border-bottom-color: olive"&gt;  
&lt;a href="pointProductController.html?flag=flagPProductsection${chl.pointseId}" class="zltda"&gt;${chl.section}&lt;/a&gt;  
&lt;/div&gt;  
**&lt;/c:if&gt;**  
**&lt;c:if test="${stat.last}"&gt;**  
&lt;div class="item" id="\_MYJD\_repair"&gt;  
&lt;a href="pointProductController.html?flag=flagPProductsection${chl.pointseId}" class="zltda"&gt;${chl.section}&lt;/a&gt;  
&lt;/div&gt;  
**&lt;/c:if&gt;**  
**&lt;/c:forEach&gt;**&lt;wbr&gt;&lt;/wbr&gt;