title: Struts 2 Arraylist of objects for loop with index
body: <p>I have an arrayList which has objects of a bean within it. In the view, I am iterating and printing the list using <code>&lt;c:foreach&gt;</code> tag. </p>
  
  <p>I am printing this list into a table, so I need to print 4 elements of a list at time inside of a <code>&lt;tr&gt;</code> tag. Then the next 4 elements in another <code>&lt;tr&gt;</code>, so on. </p>
  
  <p>How would I do that? Is there an index to use so that I can store the value and only start from there the next time I iterate the list?</p>
  
  <p>E.g. of my hypothesis:</p>
  
  <pre><code>&lt;for i=list.length i++&gt;
  {
     &lt;tr&gt;
         &lt;td&gt;${ListElement}&lt;/td&gt;
     &lt;/tr&gt;
  }
  </code></pre>