I am not sure whether this can help u or not but this bean in tapestry also
does what u are trying to do. May be it can help you just have a look.

"org.apache.tapestry.bean.EvenOdd"


Muralidhar Y
Software Engineer,
Adastrum technologies-Nikai groups,
EmiratesGroup-I.T Division,
Dubai, UAE.
Mobile : 00971-50-2256149.
http://www.adastrumtech.com
http://www.mercator.aero  
(Keep Smiling. Be happy All The Time.)

-----Original Message-----
From: Patrick Casey [mailto:[EMAIL PROTECTED] 
Sent: 03 October 2005 07:51
To: 'Tapestry users'
Subject: Brain Freeze Assistence Please

 

            Hi Folks,

 

            For some reason my brain is locking up on what I'm sure is mind
numbingly simple.

 

            I have a component template that renders a number of rows of
data.

 

            For even rows, I want to enclose to row in a 

<span class="even">ROW</span>

 

For odd rows, I want to enclose the row in a

<span class="odd">ROW</span>

 

I have a parameter I pass into the component that tells it where or not it
is even.

 

How do I conditionally set the class attribute (or any attribute) for that
matter? I know I can do:

 

<span jwcid="@Conditional" condition="ognl:even">

<span class="even">ROW</span>

</span>

 

<span jwcid="@Conditional" condition="ognl:odd">

<span class="odd">ROW</span>

</span>

 

But I *really* don't want to duplicate my row rendering code because it's
very, very large, and quite volatile so I don't want to have to duplicate
every possible future change. 

 

So what's the way to conditionally set an attribute?

 

--- Pat

 

PS Bonus points if you can explain why I'm brain freezing so hard over this
:-).

Reply via email to