You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mansour <ma...@yahoo.com> on 2007/06/27 03:34:47 UTC

stat.odd ? test

I am trying to iterate over a list and display rows in different style:


<s:iterator value="aList" status="stat" id="row">

<s:set name="foo" value="${#stat.odd ? 'odd':'even'}" />
<tr class="${foo}">

...


The resulting code have the class attribute always empty.  Like this :

<tr class="">




Can any one advice what's wrong ?


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


RE stat.odd ? test

Posted by me...@investorservicing.natixis.fr.
Depuis le 21 décembre 2006, Natexis Investor Servicing s'appelle Natixis Investor Servicing. Les adresses mails des collaborateurs ayant changé, veillez à la mise à jour de votre carnet d'adresses.


here is an example that is working.
<s:iterator value="articles" status="rowstatus">
 
       <tr nowrap class="<s:if test="#rowstatus.odd == true 
">datavalueblue</s:if><s:else>datavaluewite</s:else>">
                <s:url id="editUrl" action="edit" ><s:param 
name="codeArticle" value="%{codeArticle}" /></s:url>
                <td><s:a href="%{editUrl}" ><s:property value="titre" 
/></s:a></td>
 
        </tr>

</s:iterator> 

And here is your example revisited:

<s:iterator value="aList" status="stat">
<tr class="<s:if test="#stat.odd == true 
">odd</s:if><s:else>even</s:else>"></tr>
</s:iterator>

I hope this help.
Meissa 





Mansour <ma...@yahoo.com> 
27/06/2007 03:34
Veuillez répondre à
"Struts Users Mailing List" <us...@struts.apache.org>


A
Struts Users Mailing List <us...@struts.apache.org>
cc

Objet
stat.odd ? test






I am trying to iterate over a list and display rows in different style:


<s:iterator value="aList" status="stat" id="row">

<s:set name="foo" value="${#stat.odd ? 'odd':'even'}" />
<tr class="${foo}">

...


The resulting code have the class attribute always empty.  Like this :

<tr class="">




Can any one advice what's wrong ?


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




L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire

The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.
Let us mind the environment : let's print our mails only when necessary.


Re: stat.odd ? test

Posted by Dave Newton <ne...@yahoo.com>.
--- Mansour <ma...@yahoo.com> wrote:
> I am trying to iterate over a list and display rows
> in different style:
> 
> <s:iterator value="aList" status="stat" id="row">
> <s:set name="foo" value="${#stat.odd ?
'odd':'even'}" />
> <tr class="${foo}">

You're allowed to change my variable names.

<s:set name="foo" value="%{#stat.odd ? 'odd':'even'}"
/>
<tr class="<s:property value='#foo'/>">

I think ${foo} will work, at least if you're on a JSP
2.0 container, but I can't test it at the moment.
Can't think of any reason why it wouldn't, but the
value for <s:set.../> needs to be in OGNL EL, not JSP
EL.

d.



       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC

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