[Opensource] "zebra striping" question

Peter A. J. Pilgrim peterp at xenonsoft.demon.co.uk
Fri Aug 2 20:23:00 PDT 2002


Peter A. J. Pilgrim wrote:
> Michael Rimov wrote:
> 
>> At 11:27 AM 7/23/2002 -0600, you wrote:
>>
>>> We want to display output objects pulled out of an element iterator in
>>> alternating colors.  Has anyone done this before?  In addition to
>>> alternating colors, we would like to display outputs in different 
>>> places in
>>> a table.  For example:
>
> 
> I forgot the other part
> 
> <%= counter.intValue() %>
> 
> So you can do this in JSP
> 
> <table  ... >
> <logic:iterate .... indexId="counter" >
> 
>    <tr bgcolor="<%= counter.intValue() ? "#C0C0C0" : "E0FFE0" >

Whoops! This should have been written

     <tr bgcolor="<%= counter.intValue() % 2 == 0 ? "#C0C0C0" : "E0FFE0" >

or if you use HTML Cascading Stylesheets then like

     <tr class="<%= counter.intValue() % 2 == 0 ? "alt-row-color1" : 
"alt-row-color2" >

 >      <td>
>      ...
>      </td>
>    </tr>
> 
> </logic:iterate>
> </table>
> 
> This should give the financial market spreadsheet style alternating row
> 

Sorry for any incovenience

-- 
Peter Pilgrim         +-----\ +-++----++----+
Java Technologist     |     | | ||    ||    | 'n' Shine
                       |  O  | | ||  --+| ---+
         /\            | ._  / | | \  \ |    |
        /  \           | | \ \ | |+--  || ---+ A new day
       /_  _\  "Up"    | | | | | ||    ||    | is coming
         ||            +-+ +-+ +-++----++----+
<home page="http://www.xenonsoft.demon.co.uk/" />




More information about the Opensource mailing list