Thank you Sergiu for your quick response. I think what I
wanted was really a Plain Old Java Object to be placed in the Velocity Context.
 
Regarding this Object placed in the Velocity Context:
 
1.      1. Would
this Object be instantiated each time a new request is placed? i.e. does this
need to be static?
2.      2. Do
we need the bean syntax for properties? Please see my original post for an
example.
 
Thank you again,
O. O.


----- Messaggio originale -----
Da: Sergiu Dumitriu <sergiu.dumit...@gmail.com>
A: Velocity Users List <user@velocity.apache.org>
Cc: 
Inviato: Giovedì 8 Agosto 2013 12:10
Oggetto: Re: Documentation regarding Custom Utility Class for Velocity

It depends on what you mean by velocity tools.

As the description on http://velocity.apache.org/tools/releases/2.0/
says, a tool is just a Plain Old Java Object, so any Java object can act
as a tool.

Officially, a "tool" is something that can be automatically placed in
the context when you have a more complex/automatic Velocity Engine
setup, like VelocityViewServlet or VelocityStruts, or using one of the
configuration mechanisms listed on
http://velocity.apache.org/tools/devel/config.html

Unofficially, if you're working directly with the engine, you can place
any object in the VelocityContext when rendering a parsed template.

So, there's no restriction on the class that you're using as a tool,
other than:

- only public methods can be invoked from Velocity, but there can be
helper private methods if they help you organize the code
- if the tool is automatically instantiated, it must have a public
constructor with no parameters; if you instantiate it manually, you can
pass as many arguments as you want in the constructor   

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

Reply via email to