velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <>
Subject Re: Using generic tools outside of webapp
Date Mon, 22 May 2006 15:03:57 GMT
On 5/22/06, James Shaw <> wrote:
> I've seen some examples of using velocity generic tools in a webapp,
> but none using them standalone.
> I'm trying to use DateTool in a template.  While the docs say I can
> use it "as you would any other POJO" I'm not sure how exactly.  AIUI,
> I shouldn't require a toolbox.xml file as this is part of
> VelocityView, is this right?

correct, no toolbox is required for using generic tools.  you simple
instantiate the tool, do any configuration you want manually, put it
into the context, then use it in the template as you would anywhere

> Some examples or documentation would be
> appreciated ;-)

here's a quick example:

== java class that prepares your VelocityContext ===
DateTool date = new DateTool();
Whatever anyOtherPojo = new Whatever();

context.put("date", date);

== template being processed ===

Does that help?

> Thanks in advance
> James Shaw
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message