velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moshe Sambol <>
Subject RE: Template from String
Date Thu, 15 May 2003 07:40:15 GMT

Loading your templates from a file is just one available option.  
You might be interested in 
which you can use to load your templates from your database.

Just beware that if you choose to use it, it's doesn't come compiled in the
prebuild jars, you need to do your own "J2EE build".  There are
straightforward directions on how to do this in the readme files that
accompany Velocity.

If you're not interested in using DataSourceResourceLoader and want to stick
with your own mechanism for reading your database contents, you could create
a custom subclass of ResourceLoader.  It seems to me that such a subclass
would be very straightforward - just override getResourceStream to return a wrapped around the String which you've
fetched from your database, and provide basic no-op implementations of the
other methods.

Good luck.

> -----Original Message-----
> From: Matthew Pomar [] 
> Sent: Thursday, May 15, 2003 4:15 AM
> To:
> Subject: Template from String
> I have a database of email messages that are to be used as 
> templates with 
> Velocity. The examples assume templates will be files 
> (template.vm). I will 
> be getting the templates as java.lang.String objects. Could 
> someone tell me 
> how to load a template from a String rather than a file?
> Thanks,
> Matthew Pomar

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

View raw message