You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Tuan H. Le" <tu...@phsadc.com> on 2002/10/21 19:46:18 UTC

How to determine the last row in a collection

Hi,
I'm using <logic:iterate> to ouput the collection data and I would like to have a different outline format for the last record in a Collection. Is there a way to do this in <logic:iterate>?
ie:
<logic:present name="myCollection" scope"request">
  <logic:iterate id="data" name="myCollection" scope="request" type="com.abc.MyCollectionVO" indexId="idx" length="10" offset="0">
     // need logic to determine whether it's a last record in a collection
     // if so, display the outline with border at the bottom
  </logic:iterate>
</logic:present>

myCollection is an ArrayList and I've tried myCollection.size(), but it couldn't recognize the variable.


Thanks!
Tuan


Re: How to determine the last row in a collection

Posted by Adam Sherman <ad...@teachandtravel.com>.
Just to point out the obvious, but I assume you insert the border 
outside the iterate?

Tuan H. Le wrote:
> <logic:present name="myCollection" scope"request">
>   <logic:iterate id="data" name="myCollection" scope="request" type="com.abc.MyCollectionVO" indexId="idx" length="10" offset="0">
>      // need logic to determine whether it's a last record in a collection
>      // if so, display the outline with border at the bottom
>   </logic:iterate>

Insert border here.

> </logic:present>

A.

-- 
Adam Sherman
Software Developer
Teach and Travel Inc.
+1.613.241.3103



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>