Thanks very much!  I will.

-----Original Message-----
From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 3:53 PM
To: 'Struts Users Mailing List'
Subject: RE: Iterate Index Evaluation


Strike that ... reverse it!  I was able to use the bean:define as follows:

<logic:iterate indexId="ndx" ...>
  <bean:define id="tmpMod" value="<%= String.valueOf(ndx.intValue() % 2)
%>"/>
  <logic:equal name="tmpMod" value="0">
    even markup here
  </logic:equal>    
  <logic:notEqual name="tmpMod" value="0">
    odd markup here
  </logic:notEqual>    
</logic:iterate>

Give it a try!  The expression is still a little wicked but not as evil as
the scriptlet.

-----Original Message-----
From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 3:43 PM
To: 'Struts Users Mailing List'
Subject: RE: Iterate Index Evaluation


Er ... I think you may be right ... I know it can be done using scriptlet
for example:

<logic:iterate indexId="index" ...>
  <% if ((index % 2) == 0) {%>
    even row markup here
  <% } else { %>
    odd row markup here
  <% } %>
</logic:iterate>

But we all know how evil this is!

-----Original Message-----
From: Cohan, Sean [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 3:05 PM
To: 'Struts Users Mailing List'
Subject: RE: Iterate Index Evaluation


Thanks, but I think there will be a problem with the bean:define since the
jsp 1.1 spec does not allow you to use the same bean name more than once in
a single page (which is what we would be doing in an iterate tag.)  Unless
I'm misinterpreting.

-----Original Message-----
From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 2:49 PM
To: 'Struts Users Mailing List'
Subject: RE: Iterate Index Evaluation


Try something like ...

<logic:iterate indexId="index" ...>
  <bean:define id="indexMod2" value='<%= index % 2 %>'/>
  <logic:equal name="indexMod2" value="0">
    markup for even row here
  </logic:equal>
  <logic:notEqual name="indexMod2" value="0">
    markup for odd row here
  </logic:equal>
</logic:iterate>

-----Original Message-----
From: Cohan, Sean [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 2:40 PM
To: Struts (E-mail)
Subject: Iterate Index Evaluation


I need to iterate over a collection and be able to tell whether the current
index is odd or even.  Any ideas on how I can use the logic tag for this?

<logic:match name="index" value="odd or even?">


Thanks.


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to