title: JSTL ForEach Loop/ Array or List
body: <p>I needed to loop through items but I am also looking for a way to get the next or previous element in the items list so that as you can see below, I can check if the second item starts with the first item. Is there a way I can store the elements like in List or Array?</p>
  
  <pre><code>   &lt;c:forEach var="item" items="${entry.value.options}"&gt;                        
                      &lt;c:set var="upper" value="${item.key }"/&gt;
                      &lt;c:choose&gt;
                          &lt;c:when test="${fn:startsWith(item, upper)}"&gt;
                              &lt;c:if test="${item ne upper} }"&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;
                                          &lt;input class="parent" type="checkbox" name="criterias[${entry.key}]" value="${item.key}" /&gt;
                                          &lt;label&gt;${item.value}&lt;/label&gt;
                                      &lt;/li&gt;                                       
                                  &lt;/ul&gt;
                              &lt;/c:if&gt;
                          &lt;/c:when&gt;
                          &lt;c:otherwise&gt;
                          &lt;li&gt;
                              &lt;input class="child" type="checkbox" name="criterias[${entry.key}]" value="${item.key}" /&gt;
                              &lt;label&gt;${item.value}&lt;/label&gt;
                          &lt;/li&gt;       
                          &lt;/c:otherwise&gt;
                      &lt;/c:choose&gt;             
      &lt;/c:forEach&gt;    
  </code></pre>
  
  <p>Thanks a lot! </p>