velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: How to use DataSrouceLoader in a non web application
Date Mon, 06 Aug 2007 16:20:59 GMT
You can manually create an instance of DataSourceResourceLoader, set
the DataSource on it directly using the setDataSource() method, and
then directly inject that instance into your VelocityEngine by doing
something like:

DataSourceResourceLoader dsrl = new DataSourceResourceLoader();
dsrl.setDataSource(myDataSource);

VelocityEngine ve = new VelocityEngine();
ve.setProperty("resource.loader", "data");
ve.setProperty("data.resource.loader.instance", dsrl);
ve.setProperty("data.resource.loader.table", "foo");
... (set keycolumn etc here)

ve.init();

and you should be good to go.

On 8/2/07, Ci Ci <venus.chiu@e-dba.com> wrote:
>
> I am trying to use DataSourceResourceLoader class to load templates form a
> database. I've seen How-To on configuring it on a web application. How do
> you configure it in a non web based application?
>
> Thanks
> Ci Ci
> --
> View this message in context: http://www.nabble.com/How-to-use-DataSrouceLoader-in-a-non-web-application-tf4205261.html#a11961827
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Mime
View raw message