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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]