I'm plunging into the world of JSP development and I'm
wanting to improve on this type of [messy] logic:

<% int rowCount = 0; %>
<logic:iterate id="oi" name="myForm" property="stuff">
  <% if (++rowCount % 2 == 0) { %>
    <tr class=normalRow>
  <% } else { %>
    <tr class=altRow>
  <% } %>
      <td><bean:write name="oi" property="group3Name" /></td>
  </tr>
</logic:iterate>

My attempts have been various incarnations (for the <tr>) of the
following, utilizing iterate's -indexId-:

<logic:notEmpty name="myForm" property="stuff">
 <logic:iterate id="oi" name="myForm" property="stuff" indexId="idx">
  <tr class=<% (idx.intValue()%2==0) ? "altRow" : "normalRow"; %> >
    <td><bean:write name="oi" property="group3Name" /></td>
  </tr>
</logic:iterate>

Unfortunately, we arent using JSTL (and wont be), otherwise I
could use the solution found here:
http://cephas.net/blog/2004/02/25/jstl_vs_struts_taglib.html

Any suggestions for improvement ? 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to