commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Gilde <hgi...@optonline.net>
Subject RE: [jelly] How to create maps
Date Mon, 12 Sep 2005 03:25:30 GMT
Could you file this in JIRA? It would be extremely simple to implement if
you're interested in digging in.

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Adrian Herscu
Sent: Wednesday, September 07, 2005 6:15 AM
To: commons-user@jakarta.apache.org
Subject: Re: [jelly] How to create maps



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


---------------------------------------------------------------------
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