>>> On 8/2/07, nageshyakkanti <[EMAIL PROTECTED]> wrote: Hi, >>> [snip] >>> my velocity.properties is as follows resource.loader = classpath >>> file.resource.loader.description = File Resource Loader >>> file.resource.loader.class = >>> org.apache.velocity.runtime.resource.loader.FileResourceLoader >>> file.resource.loader.path = /templates >>> >> Nathan Bubna wrote: The FileResourceLoader is notoriously difficult >> to configure property in a webapp environment, and is impossible to >> use in a webapp run as an unexploded WAR file. >> >> I recommend looking into the WebappLoader that is part of the >> VelocityTools project. You can see the VelocityTools javadoc or >> search these mail archives for more info on it. >> > nageshyakkanti wrote: I am using an exploded war file in this. >
my understanding of the use and purpose of the FileResourceLoader is that it really comes into its own when your templates are not stored as part of your webapp at all. For instance, we use it because our templates are developed entirely separately from any webapps and stored in a "document root". This is, in fact, an Apache HTTPD docroot (httpd being used to serve static files from this, such as *.css, *.js etc). It is very useful for this purpose, but requires the specification of an absolute file path URI to the resource root (i.e. the docroot), which is a environment-specific setting and cannot be defined relative to the webapp itself. In other words, your properties file which specifies: file.resource.loader.path = /templates ... would instead need to specify: file.resource.loader.path = /path/from/root/to/templates If you do not require this separation between webapp and templates (which it sounds as though you do not), then Nathan's suggestion that you use the WebappResourceLoader is correct ... it is similar to the FileResourceLoader, but your application-relative template path would work with that. Cheers, Chris --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
