Have you taken a look at the Struts logic tags?... ...more specifically the <logic:iterate> tag. Quite sure this will do the job.
As for "displaying first N of the collection", you can set "offset" and "length" attributes to the tag, and it will do just that. You can also use any form of a Collection, including a primitive Object[]. It will retrieve an Iterator from the collection, and go over that. So ArrayList will work as well as a Vector (albeit that _little_ bit faster). HashMaps and such will also work, but the offset and length will be useless. :) There's a lot of tags in the Struts booty. Take a read over them some time. They'll be the answer to most problems. Arron. Rick Mann wrote: >Hi. > >I set up a little website as a way to teach myself Struts. It's a >user-maintained directory of electric vehicle charging locations. It's >hardly complete, but there was one thing I wanted to do and didn't see an >obvious way. > >Each Location has a bunch of user-supplied comments associated with it. My >code currently displays all of the comments in reverse chronological order. >What I'd really like to do is display only the first N such comments. > >Now, I'm pretty sure that I'm capable of making my own iterator tag(s) to do >this, and the related action of iterating over the items N through M. I also >realize that this will only work correctly for certain types of collection >(Vectors, for example, or arrays), although I suspect it can be made to be >repeatable for any type of collection. > >I guess I'm making a feature request, and looking for comments as to whether >it's a good idea to add this functionality to the existing iterator tags or >to create new tags to do it. > >Another related iterator action that I'd like to be able to perform is a >more controlled iteration. I had a situation where I wanted to construct a >string of items, separated by commas, but couldn't find an easy way to avoid >an extra comma either at the end or beginning of the string. A set of tags >to a) set up an iteration, b) get the current item, c) advance to the next >item, and d) iterate over the remaining items would be useful, don't you >think? > >Comments appreciated... > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>