velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Putting key/value pair into hashmap from velocity template
Date Wed, 19 Jul 2006 17:09:05 GMT
as Will said, there is no magic in calling methods
from within a velocity template - apart from the
convenience getFoo(), getfoo() or get("foo")

I suggest you check your class. The class *and* the
put(x,y) method must be public. And as your example shows
must take two strings parameters. The Velocity
introspector is intelligent enough to up-cast your
strings to objects if the method takes Object as

Try the output of $ to be sure you
are looking to the object you are expecting.


Matthias Hendler wrote:
> 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
> 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 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.

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

View raw message