velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Shaw" <js...@zepler.net>
Subject Re: Using generic tools outside of webapp
Date Tue, 23 May 2006 09:34:47 GMT
On 22/05/06, Nathan Bubna <nbubna@gmail.com> wrote:
> On 5/22/06, James Shaw <js102@zepler.net> 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
> else.
>
> > 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);
> =======================================

Many thanks, that's done the trick.

James Shaw

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


Mime
View raw message