commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <>
Subject Re: core:forEach collections
Date Tue, 16 Dec 2003 23:57:58 GMT

Can you be more precise on the expectactions for the JSTL compatibility 
? I can't say this is my favourite goal for jelly...

Clearly, the need to j:set is a pain... but there are many many other 
ways around... (remember jelly is flexible!):
1.- the forEachToken tag that I described here
2.- have a function like "tokenize" within jexl
3.- be able to declare functions within jexl (see the proposal of 
Ernesto Reinaldo recently, this seems to be also JSP inspired)

I would favour 1 for best predictability and confort (I think being 
able to state a tokenizer with any whitespace is really missing thus 
I would favour 2. to be quick and compatible with 3. which, to my 
taste, has the power of shortening by 50% half of the jelly scripts 


On 16-Dec-03, at 10:40 Uhr, Jörg Schaible wrote:

> 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">
> 	<echo>${i}</echo>
> </j:forEach>
> 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}">
> 	<echo>${i}</echo>
> </j:forEach>
> especially since you often have comma-separated elements reading from 
> a property file.
> Already implements this including a test case.
> Regards,
> Jörg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message