Velocity calling a vararg method
I am trying to call a varargs method from Velocity. The function is defined in a Class named "Abc" as:
public static void function(String ... values)
I set the context as
params.put("concat",new Abc());
The template contains the call to the method as:
$concat.function('Var1','var2')
If I fix the function to have one argument everything works fine, if I move to the varargs (or a byte[]
for that matter), it can't resolve it and I don't get back what I wanted. I set some log settings and go that velocity gets:
Null reference [template 'bufferTemplate', line 1, co开发者_如何学Clumn 1] :
$concat.function('Kuku','Muku') cannot be resolved.
I am using Velocity 1.6.4 and for me it works the way you've written! Update your Velocity! As far as I have seen they have support for varags
from version 1.6 !
Got it. I'm using axis, which seems to be using an older version of Velocity. Once velocity was set first in the classpath, it works. Thanks for the help.
精彩评论