commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Herscu <bmf1...@axentra.net>
Subject Re: [jelly] How to create maps
Date Wed, 07 Sep 2005 10:14:48 GMT


Adrian Herscu wrote:

> Thought that there is some special JEXL syntax that allows the creation 
> of collections, arrays and lists.
> 
> So instead of:
>     <new var="myMap" className="java.util.HashMap" />
>     <expr value="${myMap.put('foo', 'the first string')}" />
>     <expr value="${myMap.put('moo', 'the second string')}" />
> 
> one could write:
>     <set var="myMap" value="${foo:'the first string',moo:'the second 
> string'}" />
> 

Another idea:
<map var="myMap">
   <item key="foo" value="the first string" />
   <item key="moo" value="the second string" />
</map>

But JEXL syntax is better since it allows the definition of collections 
in properties files.

> Dion Gillard wrote:
> 
>> Using the new tag?
>> http://jakarta.apache.org/commons/jelly/tags.html#core:new
>>
>> On 9/7/05, Adrian Herscu <bmf1972@axentra.net> wrote:
>>
>>> Hi all,
>>>
>>> I know how to access a map in Jelly.
>>>
>>>     <forEach
>>>         var="iter"
>>>         items="${map}">
>>>         ${iter.key} = ${iter.value}
>>>     </forEach>
>>>
>>> But, how can I create a map using Jelly syntax?
>>>
>>> Thanks,
>>> Adrian.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message