• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

alternate rows in one color

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI

I am new to struts,can anyone help me put in displaying alternate rows in one different colors,the values as such are hardcoded.

Thanks

Rahesh
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a dynamic number of rows that uses an iteration?
If so, run a test if the index (or the count) of the iteration is even or odd.
If even, make it the first color.
If odd, make it the second color.
 
author
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also implement this functionality using struts-layout tags from the struts-layout home
 
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Danilo loves those layout tags so much he wrote an entire chapter on them! In Struts Recipes we have a recipe on how to extend the Iterate tag to allow you to alternate any number of colors.

You can find out how to do it by downloading the sample chapter from
http://www.manning-source.com/books/franciscus/franciscus_chp2.pdf

It recipe 2.8 on p 80. Remember, Struts tags are meant to be extended. You can extend any tag in the library to do whatever you need them to do. This recipes shows you how to do that step-by-step.
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have some columns in table (I iterate for these columns) which must be in another color. How to go about this?
example: out of 5 columns i have 2 columns with different color
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Liz Brown:
I have some columns in table (I iterate for these columns) which must be in another color. How to go about this?
example: out of 5 columns i have 2 columns with different color



Did you read the the sample of chapter two of the book Struts Recipes that the author of that book mentioned above? As he said, recipe 2.8 on p80 of the book (which is p42 of the pdf) gives you about as good an explanation as you're likely to find. I suggest taking the author's advice and having a look at this.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic