RE: How to display odd/even rows using iterator
Thanks for all your replies. Writing a scriplet is no brainer but I am trying to avoid them ( I was successful so far). Since my collection consists of beans and each bean represents a row i just added an extra member variable (sequence) which indicates if the row is odd or even. In this case you don't need any scriplets. = == Mark. > -Original Message- > From: Bart Moberts [SMTP:[EMAIL PROTECTED]] > Sent: Thursday, April 19, 2001 6:26 AM > To: [EMAIL PROTECTED] > Subject: Re: How to display odd/even rows using iterator > > > hello > > i do it this way: > > <%! String[] colors = new String[2]; int i = 0; %> > <% colors[0]="#EE"; colors[1]="#CECECE"; i = 0;%> > > > <% i = 1 - i; %> > > > > ... > > > > > grtz > > > >From: "Zeltser, Mark" <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: [EMAIL PROTECTED] > >Subject: How to display odd/even rows using iterator > >Date: Wed, 18 Apr 2001 12:00:54 -0400 > > > >Hello, > > > >I have the following code to build the table: > >= > === > >== > > >property="displayRates"> > > > > > >>filter="true"/> > > > > > >filter="true"/> > > > > > >>filter="true"/> > > > > > > > >= > === > >== > > > >I would like to set different colors for odd/even rows. How do I do this? > > > >Thanks, Mark. > > > > > >- > - > >This message is intended only for the personal and confidential use of > the > >designated recipient(s) named above. If you are not the intended > recipient > >of this message you are hereby notified that any review, dissemination, > >distribution or copying of this message is strictly prohibited. This > >communication is for information purposes only and should not be regarded > > >as an offer to sell or as a solicitation of an offer to buy any financial > > >product, an official confirmation of any transaction, or as an official > >statement of Lehman Brothers Inc. Email transmission cannot be > guaranteed > >to be secure or error-free. Therefore, we do not represent that this > >information is complete or accurate and it should not be relied upon as > >such. All information is subject to change without notice. > > > > > > _ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers Inc. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
Re: How to display odd/even rows using iterator
hello i do it this way: <%! String[] colors = new String[2]; int i = 0; %> <% colors[0]="#EE"; colors[1]="#CECECE"; i = 0;%> <% i = 1 - i; %> > ... grtz >From: "Zeltser, Mark" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: [EMAIL PROTECTED] >Subject: How to display odd/even rows using iterator >Date: Wed, 18 Apr 2001 12:00:54 -0400 > >Hello, > >I have the following code to build the table: > >== > property="displayRates"> > > > filter="true"/> > > > > > > filter="true"/> > > > > >== > >I would like to set different colors for odd/even rows. How do I do this? > >Thanks, Mark. > > >-- >This message is intended only for the personal and confidential use of the >designated recipient(s) named above. If you are not the intended recipient >of this message you are hereby notified that any review, dissemination, >distribution or copying of this message is strictly prohibited. This >communication is for information purposes only and should not be regarded >as an offer to sell or as a solicitation of an offer to buy any financial >product, an official confirmation of any transaction, or as an official >statement of Lehman Brothers Inc. Email transmission cannot be guaranteed >to be secure or error-free. Therefore, we do not represent that this >information is complete or accurate and it should not be relied upon as >such. All information is subject to change without notice. > > _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: How to display odd/even rows using iterator
Scott Walter wrote: > Although I don't like to place Java code in my JSP > pages, this is how I accomplished this: > > > <% if(index%2==0) { %> > > <% } else { %> > > <% } %> > > index++; > > > > --- Anthony Martin <[EMAIL PROTECTED]> wrote: > > I'm sure I'll get to this in my project. Why not > > make it a read property of > > the bean? > > > > protected String rowColor = "#FF" ; > > public String getRowColor ( ) { return > > this.rowColor ; } > > public void setRowColor ( String value ) { > > this.rowColor = value ; } > > > > Then all you need is a way to change that value at > > the top of the > > block by detecting the current state > > with a couple > > tag. > > Using two tags is a good solution, but wouldn't it be nice to have a kind of "if .. then .. else" feature ? Like : ... ... Any plan to implement this ? Bernard.
Paging in Struts (was Re: How to display odd/even rows using iterator)
You would need more than just enhancements to however to have paging functionality similar to the pager taglib at jsptags.com, you would also need tags for the index (previous/next, etc). I've used the pager taglib inconjunction with Struts and find it to work well... is there any point inventing the wheel again here, or would a recommendation to use that tag library, along with some examples (perhaps in the example application) suffice? Regards, James W. -- 'A $16 million Cash Injection for Smart Card Business' click below http://www.cardsetc.com to read about Cards etc's success. -- This e-mail is from Cards Etc Pty Ltd (ACN: 069 533 302). It may contain privileged and confidential information. It is intended for the named recipient(s) only. If you are not an intended recipient, please notify us immediately by reply e-mail or by phone on +61 2 9212 7773 & delete this e-mail from your system. --
Re: How to display odd/even rows using iterator
Sorry for the confusion. My aside was off-topic and not directly related to the odd/even question (though I ~would~ need to do both in the end result). I meant using iterate instead of something like < http://jsptags.com/tags/navigation/pager/ > David Winterfeldt wrote: > What are you suggesting when you mention having > iterate work like a pager? Do you mean having the > iterate tag call a method on a bean before or after it > iterates? If the interface gave the bean a handle on > the environment then it could even a create a variable > that could have the row color. > > David
Re: How to display odd/even rows using iterator
What are you suggesting when you mention having iterate work like a pager? Do you mean having the iterate tag call a method on a bean before or after it iterates? If the interface gave the bean a handle on the environment then it could even a create a variable that could have the row color. David --- Ted Husted <[EMAIL PROTECTED]> wrote: > I like Christine's answer better, but here's a > simple solution using > (ugh) a scriptlet. > > > <% int i = 0; %> > > <% i++; if ( i % 2 == 0) { %> > > <% } else { %> > > <% } %> > { columns } > > > > What I would really like to see (before I write it > myself) is code for > using iterate as a pager. The hooks seem to be > there. > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel 716 737-3463. > -- http://www.husted.com/about/struts/ __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
RE: How to display odd/even rows using iterator
Although I don't like to place Java code in my JSP pages, this is how I accomplished this: <% if(index%2==0) { %> <% } else { %> <% } %> index++; --- Anthony Martin <[EMAIL PROTECTED]> wrote: > I'm sure I'll get to this in my project. Why not > make it a read property of > the bean? > > protected String rowColor = "#FF" ; > public String getRowColor ( ) { return > this.rowColor ; } > public void setRowColor ( String value ) { > this.rowColor = value ; } > > Then all you need is a way to change that value at > the top of the > block by detecting the current state > with a couple > tag. > > > Anthony > > -Original Message- > From: Ted Husted [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 18, 2001 1:07 PM > To: [EMAIL PROTECTED] > Subject: Re: How to display odd/even rows using > iterator > > > I like Christine's answer better, but here's a > simple solution using > (ugh) a scriptlet. > > > <% int i = 0; %> > > <% i++; if ( i % 2 == 0) { %> > > <% } else { %> > > <% } %> > { columns } > > > > What I would really like to see (before I write it > myself) is code for > using iterate as a pager. The hooks seem to be > there. > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel 716 737-3463. > -- http://www.husted.com/about/struts/ = ~~~ Scott __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
RE: How to display odd/even rows using iterator
I'm sure I'll get to this in my project. Why not make it a read property of the bean? protected String rowColor = "#FF" ; public String getRowColor ( ) { return this.rowColor ; } public void setRowColor ( String value ) { this.rowColor = value ; } Then all you need is a way to change that value at the top of the block by detecting the current state with a couple tag. Anthony -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 18, 2001 1:07 PM To: [EMAIL PROTECTED] Subject: Re: How to display odd/even rows using iterator I like Christine's answer better, but here's a simple solution using (ugh) a scriptlet. <% int i = 0; %> <% i++; if ( i % 2 == 0) { %> <% } else { %> <% } %> { columns } What I would really like to see (before I write it myself) is code for using iterate as a pager. The hooks seem to be there. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/
Re: How to display odd/even rows using iterator
I like Christine's answer better, but here's a simple solution using (ugh) a scriptlet. <% int i = 0; %> <% i++; if ( i % 2 == 0) { %> <% } else { %> <% } %> { columns } What I would really like to see (before I write it myself) is code for using iterate as a pager. The hooks seem to be there. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/
RE: How to display odd/even rows using iterator
Hi, try extending the iterate tag and modify it to take in 2 (or however many you want) stylesheet parameters. Say styleGrey and styleWhite. While iterating through your collection use the different stylesheet attributes and apply them to every other row. I've got something that works similar to this so if you can't figure it out let me know and I'll send it on. Thanks, Christine Robb Programmer/Analyst Pangaea Systems PH: (250) 360-0111 FX: (250) 381-4306 www.pangaeainc.com [EMAIL PROTECTED] -Original Message- From: Zeltser, Mark [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 18, 2001 9:01 AM To: [EMAIL PROTECTED] Subject: How to display odd/even rows using iterator Hello, I have the following code to build the table: == == I would like to set different colors for odd/even rows. How do I do this? Thanks, Mark. -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers Inc. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
Re: How to display odd/even rows using iterator
I used a simple java/jsp hack to do this for something similar (multiple columns for one resultset), but maybe there's a better way. One thing I noticed is that didn't seem to like an integer primitive as opposed to a String. <% int rowCount= 0; int columnMod = 0; %> <% columnMod = rowCount% 2; rowCount++; %> chris At 12:00 PM 4/18/2001 -0400, Zeltser, Mark wrote: >Hello, > >I have the following code to build the table: > >== > > > > filter="true"/> > > > > > > filter="true"/> > > > > >== > >I would like to set different colors for odd/even rows. How do I do this? > >Thanks, Mark. > > >-- >This message is intended only for the personal and confidential use of the >designated recipient(s) named above. If you are not the intended >recipient of this message you are hereby notified that any review, >dissemination, distribution or copying of this message is strictly >prohibited. This communication is for information purposes only and >should not be regarded as an offer to sell or as a solicitation of an >offer to buy any financial product, an official confirmation of any >transaction, or as an official statement of Lehman Brothers Inc. Email >transmission cannot be guaranteed to be secure or error-free. Therefore, >we do not represent that this information is complete or accurate and it >should not be relied upon as such. All information is subject to change >without notice.
How to display odd/even rows using iterator
Hello, I have the following code to build the table: == == I would like to set different colors for odd/even rows. How do I do this? Thanks, Mark. -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers Inc. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.