[Opensource] "zebra striping" question

Michael Rimov rimovm at centercomp.com
Thu Aug 1 01:03:37 PDT 2002


At 02:05 AM 8/1/2002 +0100, you wrote:

>Have you used Struts <logic:iterate> tag. There is a tag attribute called
>"indexId" where name a JSP page attribute to store a java.lang.Integer object.
>
><logic:iterate id="row"  name="databaseRows"  indexId="counter">


WOW, thanks Peter!!

Turns out that even though the code for the Expresso extension to iterate 
included all the code for indexId, the attribute for the counter wasn't 
included in the expresso-logic.tld.  I've fixed that and will check it into 
CVS before the night is through.

So, for the record, here's a sample that's iterating over a block that 
contains two outputs with each block.

<logic:iterate id="eachItem" property="Blocks" indexId="counter">
         <%
                 String cssClass = "dataset";
                 if(counter.intValue() % 2  != 0) {
                         //Alternate row style
                         cssClass = "dataset-alt";
                 }
         %>
         <tr class="<%=cssClass%>">
                 <td width="62%"><bean:write 
name="eachItem"  property="/Output1"/></td>
                 <td width="38%"><bean:write name="eachItem" 
property="/Output2"/></td>
         </tr>
</logic:iterate>

Sandra, could you add this one to the FAQ?

Again, thanks Peter!

                                         -Mike




More information about the Opensource mailing list