Depends what you need. Take a look at # macros if the only output from the function is generated text.
http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html#Velocimacros Otherwise, the way to do this is to create a new tool (which is any java class with a zero-arg constructor aka POJO) and add it to your toolkit (covered in the other thread and a bit complicated in your case). But the tool itself is as trivial as it sounds. class FooTool { public Integer barFunction(Object x, String y, List z) { // return Integer.valueOf(...); } } Assuming FooTool is registered under tool name "foo", then use this in your template. ${foo.barFunction(x, y, z)} Look at the existing velocity tools (like math) if you need more examples. On Thu, Feb 19, 2015 at 10:22 AM, <phi...@free.fr> wrote: > > Is there a way to create dynamic methods/functions in Velocity Templates? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org