On Wed, 24 Apr 2002, Halvorson, Loren wrote:

> The one thing I really would have liked was the ability to test the
> size of a collection before I iterate it.  (in my case I needed to
> know when there is exactly 1 item) I know there was a discussion on
> this a little while ago and saw your workaround to pre-iterate it, but
> it's not a practical solution for large collections.  So while I had
> your ear, I just wanted get my vote in to add some way to do it.  
> Although I'm sure it's too late.

It's indeed too late for JSTL 1.0, though we realize it's important and
will probably address it in JSTL 1.1/JSP 1.3.  The best workaround, when
you're a Java programmer, is to provide all data the page authors will
need yourself; e.g.,

   public class MyData {
     Collection collection = ...;
     public Collection getCollection() { return collection; }
     public int getSize() { return collection.size(); }
     // accessors useful data other than size
  }

Glad to hear you're enjoying JSTL, though!  Thanks for the note.

-- 
Shawn Bayern
"JSP Standard Tag Library"   http://www.jstlbook.com
(coming this summer from Manning Publications)


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

Reply via email to