views:

129

answers:

1

Is it good to make Velocity Template Object Static?

The situation is im going to use this object in (Servlet) multi user environment populating different data for each user-request with same template.

A: 

You can make it static, only it would mean that you have to redeploy your app every time you make changes to your templates. If you are worrying about performance (and reading template from file every time is indeed slow) better solution would be to enable template caching which helps a lot, that way you still can make changes to templates on the fly without sacrificing performance.

file.resource.loader.cache = true/false
file.resource.loader.modificationCheckInterval = <seconds between checks>
serg