I'm using <c:forEach>
to iterate over a List
like below:
<c:forEach items="${list}" var="item">
${item}
</c:forEach>
How can I skip printing of the first item of the list?
You can use varStatus
attribute to get hold of the iteration status which in turn has among others a isFirst()
method which you could check in a <c:if>
block.
<c:forEach items="${list}" var="item" varStatus="loop">
<c:if test="${not loop.first}">
${item}
</c:if>
</c:forEach>