Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Matthias Hendler
Hello, I try to put a key/value pair to a hashmap from velocity template. First I put a new hashmap object into velocity context named myMap. In my templates I can write: ... $myMap.clear() Size: $myMap.size() ... The above works fine. Now I want to put a key/value pair into the hashmap using

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread apache
try without the square brackets... ;) Christoph Matthias Hendler wrote: Hello, I try to put a key/value pair to a hashmap from velocity template. First I put a new hashmap object into velocity context named myMap. In my templates I can write: ... $myMap.clear() Size: $myMap.size() ... The

Re: Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Matthias Hendler
Thanx Chris, but this doesn't solve the problem. :( It's still the same error. I also tried to use the method set(index, object) from arraylist, but this also doesn't work. I guess that velocity does some magic and don't calls the put-method from hashmap or the set-method from arraylist. I

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Will Glass-Husain
Hi Matthias-- There's no magic. If there are parens, it assumes it is a method call $abc.foo(data) calls the foo method with the argument data. $abc.foo would call either getFoo(), getfoo() or (for a Map) get(foo) WILL Matthias Hendler wrote: Thanx Chris, but this doesn't solve the

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Barbara Baughman
try $myMap.put(123,test) Barbara Baughman X2157 On Wed, 19 Jul 2006, Matthias Hendler wrote: Hello, I try to put a key/value pair to a hashmap from velocity template. First I put a new hashmap object into velocity context named myMap. In my templates I can write: ... $myMap.clear()

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Henning P. Schmiedehausen
Matthias Hendler [EMAIL PROTECTED] writes: Hello, Hi, I try to put a key/value pair to a hashmap from velocity template. First I put a new hashmap object into velocity context named myMap. In my templates I can write: ... $myMap.clear() Size: $myMap.size() ... The above works fine. Now I want

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Henning P. Schmiedehausen
Matthias Hendler [EMAIL PROTECTED] writes: I have found at http://www.freebok.net/help/velocity4.html the following example: $sisyphus.pushRock() ## Velocity assumes I mean $sisyphus.getRock() Its not discussed in detail what the author meant by his example, but I wonder how velocity assumes

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Henning P. Schmiedehausen
Will Glass-Husain [EMAIL PROTECTED] writes: would call either getFoo(), getfoo() or (for a Map) get(foo) Not just for a map. For _any_ object. If it has a get(Object) method, this gets called. I've used this many times in Turbine tools which definitely don't implement Map. Best regards

Re: Putting key/value pair into hashmap from velocity template

2006-07-19 Thread Will Glass-Husain
ah - thanks for the correction. not every day I learn something new about Velocity. WILL Henning P. Schmiedehausen wrote: Will Glass-Husain [EMAIL PROTECTED] writes: would call either getFoo(), getfoo() or (for a Map) get(foo) Not just for a map. For _any_ object. If it has a