Hi all,

I'm getting familiarized with Velocity, and I'm wondering about how I should
handle the following case:

I have a utility class called "Utils". Now typically if I wanted to use the
member functions in this class in my other Java classes I would declare them
static and reference them as so "Utils.checkInput(int)".

Now with Velocity and the idea that if I want these utilities available to
the VTL, I understand I need to put the object in the VelocityContext. From
what I have seen (for example with the VelocityFormatter tool), a new object
is created and put in the context

velocityContext.put("formatter", new VelocityFormatter());

So my question is: what do I do with my Utils class? Should I create a new
instance as well? Does that mean I should change my static methods to
non-static methods? I guess my inexperience is showing here :)

Thanks!
John

Reply via email to