title: Getting elements of arraylist based on index in jstl
body: <p>This is perhaps a relatively simple thing to do but for some reason I don't seem to get it right.</p>
  
  <p>How does one get an element from an arrayList in jstl based on an index.</p>
  
  <p>In pure java, lets say I have this arralist</p>
  
  <pre><code>ArrayList&lt; String &gt; colors = new ArrayList&lt; String &gt;();
     colors.add("red");
     colors.add("orange");
     colors.add("yellow");
     colors.add("green");
     colors.add("blue");
  </code></pre>
  
  <p>if I do <code>System.out.println(colors.get(1));</code> I get the first color from the arrayList based
  on the index I supplied which happens to be <code>red</code>. </p>
  
  <p>Wondering how to achieve that in jstl. I played with the foreach tag in jstl but did not quite get it right.</p>
  
  <pre><code>&lt;c:forEach items="colors" var="element"&gt;    
   &lt;c:out value="${element.get(1)}"/&gt;
  &lt;/c:forEach&gt;
  </code></pre>