<c:forEach begin="0" end="6" step="2" varStatus="ab">
<!-- 偶数在上,奇数在下。循环控制 -->
<div class="r_div">
<c:forEach items="${goods}" var="goods" begin="${ab.index}" end="${ab.index+1}" step="1" varStatus="abc">
<%-- <h1>${abc.index} </h1> --%>
<c:choose><c:when test="${abc.index % 2 == 0 }">
<div class="r_top">
<a href="http://${goods.url}"><img src="${goods.picture}" height="200" width="200"/></a>
<h3><a href="http://${goods.url}">${goods.name}</a></h3>
<h4>${goods.price}元</h4>
</div></c:when>
<c:otherwise>
<div class="r_bot">
<img src="${goods.picture}" height="100" width="100"/>
<p><a href="http://${goods.url}">${goods.name}</a><br><span>¥${goods.price}</span></p>
</div></c:otherwise>
</c:choose> </c:forEach>
</div>
</c:forEach>
JSTL一个高级的用法
最新推荐文章于 2018-09-27 23:22:00 发布