velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Douglass" <>
Subject clearing and setting Velocity properties
Date Sat, 30 Aug 2003 08:32:11 GMT
	I'm integrating Velocity into an existing app, and need help with the way
the Velocity object is initialized. I understand that it is a singleton, and
that calling init() repeatedly will have no effect. However, I was surprised
that the following code also doesn't work as one might think:;
		Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, "foo");
		Object o1 = Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH);
		Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, "bar");
		Object o2 = Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH);

o1 and o2 both end up being "." ... which is apparently the default value
from calling Velocity.init(). So, do I understand that there is no way to
set the properties after the first call to .init(...)? In my application, I
would like to set Velocity.FILE_RESOURCE_LOADER_PATH every time before I
call .merge. Is this possible, as Velocity is, or do I need to customize it?
If I need to customize it, has anybody made this change already, and what is
the best method to do so? My first thought would be to destroy Velocity
object and create it new each time. Thanks for your thoughts,

Robert Douglass

View raw message