Created
September 23, 2016 04:51
-
-
Save devheedoo/131e25ae31094be536634bf3db6d52b6 to your computer and use it in GitHub Desktop.
Pratice JSTL c tag - forEach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<c:forEach items="${list}" var="item" varStatus="stat"> | |
<!-- varStatus has index attribute that counts automatically --> | |
<c:if test="${stat.index == 0}">the first item</c:if> | |
<a href="${item.link}" <c:if test="${(item.prop1 == 'A') || (empty item.prop1)}"> attr1="val1" </c:if>> | |
<!-- src can use the value --> | |
<img src="/file/${item.prop2}" alt="${item.prop3}" /> | |
</a> | |
</c:forEach> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment