You can either use VelocityTools (you'll probably find VelocityTools 2
easier, though it's in alpha still) or else just create a global
VelocityContext instance and chain all other context objects to it:
//pseudo-code
VelocityContext global = new VelocityContext();
fillGlobalContext(global);
for (SomeXMLOrOtherItem foo : thingstoprocess) {
// chain the local and global contexts
VelocityContext local = new VelocityContext(global);
processXMLOrOtherItem(foo, local);
}
On 10/19/07, jnusaira <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I am using Velocity for templating of some XML and other items. (not UI
> front end)
>
> So I have a singleton containing the VelocityEngine.
>
> I need to pass in some utility classes to it (like a DateUtil and some
> custom ones). However I'd like to initialize it at the begining on engine
> creation. Is there a way of doing that??
>
> Obviously i can just attach it to the context objects when passing through
> but i'd prefer not to.
>
> Thanks
>
> --
> View this message in context:
> http://www.nabble.com/Global-Context-Objects--tf4655200.html#a13301024
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]