tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helios Alonso <>
Subject Re: Rotating tables?
Date Wed, 04 Aug 2004 13:27:54 GMT
I think he wants a table like this:

+ John (in red)
+ Mark (in blue)
+ Nic (in green)
+ Helios (in red)
+ David (in blue)

If you have an array of 3 colors named colors (I dont know but, maybe the 
set tag can build a mapping that works like an array...)

Try this:
<!-- initialization -->
<c:set var="colorIndex" value="0"/>
<!-- loop -->
<td bgcolor="${colors[colorIndex++%3]}" >

In the expression you're coding the round robin (increment and modulus 3) 
and the selection of the color based on the index.

But, I didn't try it.  I hope the modulus is a valid construction in EL.

At 11:05 04/08/2004 +0200, you wrote:
>I'm not exactly sure what you mean with "rotate"?!
>Do you just have a collection that you want to iterate - with each each 
>entry corresponding to a "row" in the table? Or shall every row display a 
>different "column" of your table? It's hard to understand from your examples..
>For displaying tabular data, you should check out the displaytag-library: 
>  - it has nothing  to with jstl, but 
>gives you everything you will likely ever need for displaying tables...
>Nic Werner wrote:
>>    I have a table of data that I'd basically like to rotate, is this
>>possible/smart in JSTL?
>>Basically, I have an attribute with three colors, each one is a
>>different row in a table.
>>001 Blue data
>>001 Green data
>>002 Purple data
>>I want to have one row:001 | Blue Data | Green Data | Purple Data.
>>Any suggestions? Please help by pointing me elsewhere if you can....
>>- Nic
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
>Stefan Frank
>iBioS - Intelligent BioInformatics Systems
>DKFZ - German Cancer Research Center
>Im Neuenheimer Feld 580
>69120 Heidelberg
>Tel.: +49 (0) 6221 42-3612
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message