c标签跳出当前循环
原来的代码:
<c:forEach items="${campaign.promotions}" var="promotions" end="${exitId}">
<c:if test="${promotions.oneTimeUse == true}">
<c:set var="exitId" value="0"></c:set>
<p>Limited one time offer</p>
</c:if>
</c:forEach >
修改后的代码:
<c:forEach items="${campaign.promotions}" var="promotions" end="${exitId}">
<c:if test="${promotions.oneTimeUse == true}">
<c:set var="exitId" value="0"></c:set>
<p>Limited one time offer</p>
</c:if>
</c:forEach >
实现的功能:遍历promotions数组,只要其中一个对象的oneTimeUse值为true,就显示一行文字:Limited one time offer,若任何一个对象的oneTimeUse值都不为true,则不显示。所以用到了c标签的跳出循环。