This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to solve this simple problem in jstl ?

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:choose> comes to mind
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the syntax of your HTML? Specifically the color values?
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the generated HTML look like?
[ April 11, 2005: Message edited by: Bear Bibeault ]
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic