title: How to select the first element of a set with JSTL?
body: <p>I managed to do it with the next code but there must be an easier way. </p>
  
  <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
  
  
  &lt;c:if test="${fn:length(attachments) &gt; 0}"&gt;
      &lt;c:forEach var="attachment" items="${attachments}" varStatus="loopCount"&gt;
          &lt;c:if test="${loopCount.count eq 1}"&gt;
           attachment.id
          &lt;/c:if&gt;
      &lt;/c:forEach&gt;
  &lt;/c:if&gt;
  </code></pre>