Hi Piloupy,

You can do this using JSTL as such:

<c:forEach var="item" items="myCollection" varStatus="status">
        <c:set var="myOutput" value="${myOutput}${item}" />
        <c:if test=${not status.last}>
                <c:set var="myOutput" value="${myOutput}," />
        </c:if> 
</c:forEach>

Then you can reference ${myOutput} anywhere you like.

HTH,
-Rod

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of piloupy
GOTTAPIL
Sent: Friday, April 27, 2007 10:14
To: Struts Users Mailing List; Martin Gainty
Subject: Re: <logic:iterate> how to test the 1st and last iteration ?

>> To Olivier :

Here's what I've done :

### CODE  : begin ###
<bean:size id="colSize" name="myCollection"/>
<logic:iterate id="e" indexId="eid" name="myCollection">
  <logic:equal name="eid" value="colSize">
    <bean:write name="e" property="name" />,
  </logic:equal>
  <logic:notEqual name="eid" value="colSize">
    <bean:write name="e" property="name" />,
  </logic:notEqual>
</logic:iterate>
### CODE  : end ###

But it doesn't work. I don't know how to use correctly the <logic:equal> tag
:-(

I thought I may try the <logic-el:equal name="eid"
value="${colSize}">, but the <logic-el:equal> tag doesn't exist...

If it is possible, I'd like to only use Struts tags, but if there's no
way to do what I need, I'll use the JTSL tags...

Geez, if it was Java code, it'd be so simple... these Struts tags make
me think that I'm a stupid guy... *sigh*

By the way, Olivier, if you're french, Merci pour ton aide ;-)

piloupy

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




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

Reply via email to