aspose file tools*
The moose likes JSP and the fly likes how to solve this simple problem in jstl ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to solve this simple problem in jstl ?" Watch "how to solve this simple problem in jstl ?" New topic
Author

how to solve this simple problem in jstl ?

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, i currently facing the problem in jstl tag, i'm not sure what tag to use in order to tackle my problem



if i have condition as above, which actually use to make different color in each row, can somebody recommend the way to solve this out ? thank you
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
<c:choose> comes to mind


42
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

You haven't given much context in which to help you, but I'll take a stab.

Assuming JSP 2.0, and that you are using something along the lines of the following to iterate over the collection you are using to build the table:



it should not look too different from what you already have:



If you are not using JSP 2.0, you'll need to follow Jeroen's suggestion of a combination of <c:choose> and <c:set> to set up a variable for the style class since the ternary operator (?) is not available in the JSTL 1.0 Expression Language.
[ April 08, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks for reply, Bear Bibeault and Jeroen Wenting



why in this case, my table didn't make the rows of record in different color, is there any mistake i done ?

the result given me he whole table with blue color
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

Have you checked the syntax of your HTML? Specifically the color values?
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, Bear Bibeault , i try the following which give me same result(blue), all the row is in one color, but not interchange



i'm using tomcat 5.5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

What does the generated HTML look like?
[ April 11, 2005: Message edited by: Bear Bibeault ]
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
it look like a table with all rows that highlighted with one color(dark blue) ..but my row color suppose interchange with white and green color
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to solve this simple problem in jstl ?