velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Hendler" <hendl...@gmx.de>
Subject Re: Re: Putting key/value pair into hashmap from velocity template
Date Wed, 19 Jul 2006 15:52:27 GMT
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 have verified both tests by calling the methods clear() and size() on hashmap and arraylist
to be sure, that the objects exists in the velocity context.

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 method calls.

















-------- Original-Nachricht --------
Datum: Wed, 19 Jul 2006 17:00:13 +0200
Von: apache@recks.org
An: Velocity Users List <velocity-user@jakarta.apache.org>
Betreff: Re: Putting key/value pair into hashmap from velocity template

> 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 above works fine. Now I want to put a key/value pair into the
> hashmap using the method put(object, object).
> > 
> > So I wrote:
> > ...
> > ${myMap.put(["123", "test"])}
>                ^             ^
> > ...
> > And I get an exception: "${myMap.put(["123", "test"])} is not a valid
> reference."
> > 
> > What's wrong?
> > 
> > Thanx 
> > Matthias
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

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


Mime
View raw message