• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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.
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic