Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

Re: Jsp 2, tag files and collections...

Erik Beijnoff

2004-02-24


>I want to a write tag file that is sort of like a specific
> version of the foreach tag - I want to pass
>in a collection of objects (not strings).

>When passing the collection to the tag file it seems
>to evaluate the toString on each element and then pass
>this to the tag file as a comma separated list?

>Is this the spec required behaviour or tomcat?

Why don't you just use the JSTL forEach tag as is? It can handle just
about any Collection, List, Map etc. that exists in Java and has a
bundle of built in features to ease iteration. You just use dot notation
to get the desired property from the objects in the collection.

And to answer your question, no, tag files should handle parameters as
first class objects, not convert them to strings.

Regards Erik Beijnoff

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com


©2008 junlu.com - Jax Systems, LLC, U.S.A.