"piloupy GOTTAPIL" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> What I want to do is quite simple. I'd like to know how to test in a
> <logic:iterate> when I'm at the first or last iteration.
>
> My present problem is to parse a collection of String and display the
> results like this :
>
> ### CODE : begin ###
> value1, value2, value3
> ### CODE : end ###
>
> And as you can see, for the last iteration, I mustn't displey the
> comma character.
>
> My present code is :
>
> ### CODE : begin ###
> <logic:iterate id="e" name="myCollection">
>   <bean:write name="e" property="name" />,
> </logic:iterate>
> ### CODE : end ###
>
> Thanks in advance :)
>
> piloupy


how about using the length and offset attributes like so:

<!--display first item of list with no comma-->
 <logic:iterate id="e" name="myCollection" length="1">
  <bean:write name="e" property="name" />
</logic:iterate>

<!--display remaining items of list with a  comma and space prepended to
each-- >
<logic:iterate id="e" name="myCollection" offset="1">
  , <bean:write name="e" property="name" />
</logic:iterate>




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

Reply via email to