tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helios Alonso <halo...@atg.com.uy>
Subject Re: Rotating tables?
Date Wed, 04 Aug 2004 18:49:02 GMT
Ups, I misundestood the question.
The best would be having logic that returns other collection (not 
necessarily the BD).

But if the tables are coded this way:

id sub-id color

x 1 red
x 2 green
x 3 blue
y 1 purple
y 2 yellow
y 3 magenta

And there aren't other better solutions (BD transformations or Java logic 
behind the bean), you could do this:

select * from colors c, colors c1, colors c2, colors c3
where
c.id = c1.id and c.id = c2.id and c.id = c3.id
and
c1.subid = 1
and
c2.subid = 2
and
c3.subid = 3

Of course it can be time consuming depending of the database and it depends 
on the fixed number of columns.

:-)


At 13:05 04/08/2004 -0400, you wrote:
> >>is this possible/smart in JSTL
>
>May be possible but not smart.
>Should be returned by the database & just displayed by JSTL.
>You need a crosstab query. Which database are you using?
>
>
>Quoting Helios Alonso <halonso@atg.com.uy>:
>
> >> 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 -->
> >> <tr>
> >> <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:
> >> >http://displaytag.sourceforge.net/  - it has nothing  to with jstl, but
> >> >gives you everything you will likely ever need for displaying tables...
> >> >
> >> >cheers
> >> >stf
> >> >
> >> >Nic Werner wrote:
> >> >>Greetings,
> >> >>    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: taglibs-user-unsubscribe@jakarta.apache.org
> >> >>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >> >
> >> >--
> >> >Stefan Frank
> >> >iBioS - Intelligent BioInformatics Systems
> >> >http://www.dkfz-heidelberg.de/ibios
> >> >DKFZ - German Cancer Research Center
> >> >Im Neuenheimer Feld 580
> >> >69120 Heidelberg
> >> >Tel.: +49 (0) 6221 42-3612
> >> >Mail: s.frank@dkfz-heidelberg.de
> >> >
> >> >
> >> >---------------------------------------------------------------------
> >> >To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> >> >For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >>
> >>
>
>
>David Schwartz
>Array Software Inc.
>http://www.arrayone.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message