I managed to do it with the next code but there must be an easier way.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:if test="${fn:length(attachments) > 0}">
<c:forEach var="attachment" items="${attachments}" varStatus="loopCount">
<c:if test="${loopCount.count eq 1}">
attachment.id
</c:if>
</c:forEach>
</c:if>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…