commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject RE: core:forEach collections
Date Tue, 16 Dec 2003 09:40:15 GMT
Paul Libbrecht wrote on Tuesday, December 16, 2003 10:01 AM:

> To all that execpt core:forEach to accept such things as a
> string-with-separator, dare I suggest a work is done on a
> separate tag
> than forEach ?
> I do think forEach makes sense with collections and I do
> believe it is
> kind of sad to expect a collection out of a... string-object... so I
> would really prefer having something like core:forEachTokens
> with good
> attributes like the token-list, wether to go through tokens... and
> possibly with other attributes like token-family names (e.g. any
> whitespace, any character, any capital, as
> java.lang.Character offers).

It is the way it is specified in JSTL (1.0, chapter 6.1.1) anf therefore something that is
expected to work in this way. Admited, it is a convenience enhancement, but looking at Jelly
it is really much more fun to write:

<j:foreach var="i" items="a,b,c">

than to introduce everytime an additional variable for nothing:

<u:tokenize var="i.split" delim=",">a,b,c</:u:tokenize>
<j:foreach var="i" items="${item.split}">

especially since you often have comma-separated elements reading from a property file.
Already implements this including a test case.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message