You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Erik Weber <er...@mindspring.com> on 2004/08/10 07:48:12 UTC
EL question
I have a logic:iterate tag that is creating HTML table rows.
I want to set a bgcolor variable to use for each row. If the row is even
numbered, I want to use color A. If the row is odd numbered, I want to
use color B.
What tags should I use? What EL operation should I use to determine if
the current iterator index is even or odd?
I was thinking along the lines of:
begin logic:iterate
set bg color var to 'A'
if iterator index is odd, set bg color to 'B'
render the table row
end logic:iterate
I would appreciate some advice on how to implement this neatly, using
the EL tags or JSTL tags. I'm trying to graduate from using scriptlets
for stuff like this.
Thanks,
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: EL question
Posted by Erik Weber <er...@mindspring.com>.
Worked like a charm.
Thanks a million,
Erik
Hari Saptoadi wrote:
> <logic:iterate id="id" property="dp" name="YourFormBean" indexId="idx" >
> <tr >
> <c:choose>
> <c:when test="${idx%2==0}">
> <td class="tdContent" >
> </c:when>
> <c:otherwise>
> <td class="tdContent2" >
> </c:otherwise>
> </c:choose>
> <html-el:multibox property="checkboxList"
>onclick="unCheckIt()" value="${id.index}" />
> </td>...............and so on
>
>notes : class=tdContent2 or class=tdContent defines in css
>
>----- Original Message -----
>From: "Erik Weber" <er...@mindspring.com>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Sent: Tuesday, August 10, 2004 12:48 PM
>Subject: EL question
>
>
>
>
>>I have a logic:iterate tag that is creating HTML table rows.
>>
>>I want to set a bgcolor variable to use for each row. If the row is even
>>numbered, I want to use color A. If the row is odd numbered, I want to
>>use color B.
>>
>>What tags should I use? What EL operation should I use to determine if
>>the current iterator index is even or odd?
>>
>>I was thinking along the lines of:
>>
>>begin logic:iterate
>> set bg color var to 'A'
>> if iterator index is odd, set bg color to 'B'
>> render the table row
>>end logic:iterate
>>
>>I would appreciate some advice on how to implement this neatly, using
>>the EL tags or JSTL tags. I'm trying to graduate from using scriptlets
>>for stuff like this.
>>
>>Thanks,
>>Erik
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: EL question
Posted by Hari Saptoadi <ha...@indonesian-aerospace.com>.
<logic:iterate id="id" property="dp" name="YourFormBean" indexId="idx" >
<tr >
<c:choose>
<c:when test="${idx%2==0}">
<td class="tdContent" >
</c:when>
<c:otherwise>
<td class="tdContent2" >
</c:otherwise>
</c:choose>
<html-el:multibox property="checkboxList"
onclick="unCheckIt()" value="${id.index}" />
</td>...............and so on
notes : class=tdContent2 or class=tdContent defines in css
----- Original Message -----
From: "Erik Weber" <er...@mindspring.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, August 10, 2004 12:48 PM
Subject: EL question
> I have a logic:iterate tag that is creating HTML table rows.
>
> I want to set a bgcolor variable to use for each row. If the row is even
> numbered, I want to use color A. If the row is odd numbered, I want to
> use color B.
>
> What tags should I use? What EL operation should I use to determine if
> the current iterator index is even or odd?
>
> I was thinking along the lines of:
>
> begin logic:iterate
> set bg color var to 'A'
> if iterator index is odd, set bg color to 'B'
> render the table row
> end logic:iterate
>
> I would appreciate some advice on how to implement this neatly, using
> the EL tags or JSTL tags. I'm trying to graduate from using scriptlets
> for stuff like this.
>
> Thanks,
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org