Niall,

Your response got me headed in the right decision.  I have already written
my own iteration scheme that rolls through a returned RowSet.  As such, I
went ahead and wrote a tag that would return a class attribute the will
rotate through class values.  Example:

<tr <afrs:RotateClass id="caseTableClasses" classes="dataViewOdd
dataViewEven"/> >

where

id attribute: uniquely identifies this set of class values to rotate through
for this page (scoped within the pageContext)

classes attribute: provides a space delimited list of class values to rotate
through.  Note that even though my examples shows only two class items,
there could be any number.

The example above would yeild:

<tr class="dataViewOdd ">  on the first time through, and

<tr class="dataViewEven ">  on the second time through

The tag is not dependant on any iteration sheme other than it expects to be
used within the scope of some type of iteration.  The tag also assumes that
the classes identified in the 'classes' attribute have been set up in a
style sheet or style tag.

If anyone thinks this would be generically useful, I'd be glad to contribute
it to the taglibs project.  If it appears to be redundant effort, I won't
bother.

Thanks for the response,

Bill Pfeiffer

----- Original Message -----
From: "Niall Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 11, 2001 6:02 PM
Subject: RE: Determining odd-even table rows


> I have a RowTag that does this, it generates <tr> elements and you can
> specify either oddColor/evenColor attributes to generate bgcolor=
attributes
> or oddStyle/evenStyle parameters to generate class= attributes for CSS.
>
> So the jsp looks like this:
>
>   <table>
>     <logic:iterate id=".." name=".." property="..">
>        <util:row oddColor="#C0C0C0" evenColor="#FF0000">
> <td>.....</td>
> <td>.....</td>
>        </util:row>
>     </logic:iterate>
>   </table>
>
> You can either specify both odd and even or just one of them.
>
> I'll send it if you're interested.
>
> Niall
>
>
> > -----Original Message-----
> > From: Bill Pfeiffer [mailto:[EMAIL PROTECTED]]
> > Sent: 11 May 2001 20:08
> > To: Struts-User
> > Subject: Determining odd-even table rows
> >
> >
> > I'm trying to figure out how to do a green-bar effect (different
backround
> > colors for every other row of a table) with struts/jsp.  I am using a
> > tagified javax.sql.Rowset.  I can iterate through the rowset via my tags
> > (reworked jakarta DBTags).  The problem, more of a mental block,
> > is how do I
> > alternate the backround colors of the html rows I am writing WITHOUT
> > resorting to scriptlets.  I have just added a tag to get the
> > current row, so
> > I have that returing, but what do I do with it?
> >
> > The logic tags in struts deal only with comparisons to constants.
> >  I need to
> > do some math to determine whether the current row is odd/even so I can
set
> > the backround.
> >
> > Is it easier than this and I'm missing it?
> >
> > My goal here is not to do any scriplets.  I'm putting together a
> > set of tags
> > to help our web guy build pages using only tags.
> >
> > Thanks for any help,
> >
> > Bill Pfeiffer
> >
> >
>
>

Reply via email to