You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Duffy <md...@yahoo.com> on 2003/05/25 21:43:47 UTC

Nested Tags - Alternating Table Row Background Colors

With sriptlets, alternating the row background colors in a table
(eg., light grey/darker grey) is fairly simple.

Has anyone come up with a simple, elegant approach for doing this
with nested tags?

Thanks.

Mike

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Nested Tags - Alternating Table Row Background Colors

Posted by Affan Qureshi <qu...@etilize.com>.
Or maybe to avoid the extra markup for just the alt color we can have some
method in the form bean and call it as a property that returns an alternate
color every time. But would that be overkill?
Cheers,
Affan

----- Original Message -----
From: "Steve Raeburn" <st...@ninsky.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, May 26, 2003 1:28 AM
Subject: RE: Nested Tags - Alternating Table Row Background Colors


> Just a teeny addition to this. If you specify the row colors using CSS it
> make it easier to change the formatting later.
>     ...
>     <c:when test="${(index % 2) == 0}">
>         <tr class="evenRow">
>     </c:when>
>     <c:when test="${(index % 2) == 1}">
>         <tr class="oddRow">
>     </c:when>
>     ...
>
> Steve
>
> -----Original Message-----
> From: Michael Ruppin [mailto:mruppin@yahoo.com]
> Sent: May 25, 2003 12:53 PM
> To: Struts Users Mailing List
> Subject: Re: Nested Tags - Alternating Table Row Background Colors
>
>
> I use JSTL tags, although it might be possible with
> nested:logic if there's a MOD operator available:
>
>  <%@ taglib uri="/tags/jstl-c" prefix="c" %>
>  ...
>  <nested:iterate
>       id="target"
>       name="form"
>       property="subform.targets"
>       indexId="index">
>       <c:choose>
>           <c:when test="${(index % 2) == 0}">
>               <tr bgcolor="#000000">
>           </c:when>
>           <c:when test="${(index % 2) == 1}">
>               <tr bgcolor="#ffffff">
>           </c:when>
>       </c:choose>
>           <td>
>           </td>
>       </tr>
>   </nested:iterate>
>
> HTH
>
> m
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Nested Tags - Alternating Table Row Background Colors

Posted by Steve Raeburn <st...@ninsky.com>.
Just a teeny addition to this. If you specify the row colors using CSS it
make it easier to change the formatting later.
    ...
    <c:when test="${(index % 2) == 0}">
        <tr class="evenRow">
    </c:when>
    <c:when test="${(index % 2) == 1}">
        <tr class="oddRow">
    </c:when>
    ...

Steve

-----Original Message-----
From: Michael Ruppin [mailto:mruppin@yahoo.com]
Sent: May 25, 2003 12:53 PM
To: Struts Users Mailing List
Subject: Re: Nested Tags - Alternating Table Row Background Colors


I use JSTL tags, although it might be possible with
nested:logic if there's a MOD operator available:

 <%@ taglib uri="/tags/jstl-c" prefix="c" %>
 ...
 <nested:iterate
      id="target"
      name="form"
      property="subform.targets"
      indexId="index">
      <c:choose>
          <c:when test="${(index % 2) == 0}">
              <tr bgcolor="#000000">
          </c:when>
          <c:when test="${(index % 2) == 1}">
              <tr bgcolor="#ffffff">
          </c:when>
      </c:choose>
          <td>
          </td>
      </tr>
  </nested:iterate>

HTH

m


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Nested Tags - Alternating Table Row Background Colors

Posted by Michael Ruppin <mr...@yahoo.com>.
I use JSTL tags, although it might be possible with
nested:logic if there's a MOD operator available:

 <%@ taglib uri="/tags/jstl-c" prefix="c" %>
 ...
 <nested:iterate
      id="target"
      name="form"
      property="subform.targets"
      indexId="index">
      <c:choose>
          <c:when test="${(index % 2) == 0}">
              <tr bgcolor="#000000">
          </c:when>
          <c:when test="${(index % 2) == 1}">
              <tr bgcolor="#ffffff">
          </c:when>
      </c:choose>
          <td>
          </td>
      </tr>
  </nested:iterate>

HTH

m

--- Mike Duffy <md...@yahoo.com> wrote:
> With sriptlets, alternating the row background
> colors in a table
> (eg., light grey/darker grey) is fairly simple.
> 
> Has anyone come up with a simple, elegant approach
> for doing this
> with nested tags?
> 
> Thanks.
> 
> Mike
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org