wood burning stoves 2.0*
The moose likes Struts and the fly likes alternate rows in one color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "alternate rows in one color" Watch "alternate rows in one color" New topic
Author

alternate rows in one color

Rahesh Kumar
Ranch Hand

Joined: Sep 10, 2004
Posts: 53
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
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Danilo Gurovich
author
Greenhorn

Joined: Aug 08, 2002
Posts: 7
You can also implement this functionality using struts-layout tags from the struts-layout home


Danilo Gurovich<br />Manager, Web Development<br /> <br />dgurovich@lowermybills.com<br />2401 Colorado Ave., 2nd Floor <br />Santa Monica, CA 90404<br />(310) 998-6412
George Franciscus
author
Ranch Hand

Joined: Jan 25, 2005
Posts: 32
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.


George Franciscus<br />george.franciscus@nexcel.ca<br /><a href="http://www.nexcel.ca" target="_blank" rel="nofollow">http://www.nexcel.ca</a><br /><a href="http://www.manning.com/franciscus" target="_blank" rel="nofollow">http://www.manning.com/franciscus</a>
Liz Brown
Ranch Hand

Joined: Oct 22, 2002
Posts: 112
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
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: alternate rows in one color
 
Similar Threads
Reg: Fetch Size
logic iterate
xml data islands + alternate row color
Shadding rows in JTable
some columns in different color of a table - help!