title: How to alternate HTML table row colors using JSP?
body: <p>How do I alternate HTML table row colors using JSP?</p>
  
  <p>My CSS looks something like:</p>
  
  <pre><code>tr.odd {background-color: #EEDDEE}
  tr.even {background-color: #EEEEDD}
  </code></pre>
  
  <p>I want to use <code>&lt;c:forEach&gt;</code> to iterate over a collection. </p>
  
  <pre><code>&lt;c:forEach items="${element}" var="myCollection"&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;c:out value="${element.field}"/&gt;&lt;/td&gt;
      ...
    &lt;/tr&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>I need an int count variable or boolean odd/even variable to track the row. Then my <code>&lt;tr&gt;</code> tag would look something like:</p>
  
  <pre><code>&lt;tr class="odd or even depending on the row"&gt;
  </code></pre>