On 9/1/05, prameet sinha <[EMAIL PROTECTED]> wrote:
> hello everyone,
> how to configure properties if i want to laod a velocity template which is
> not in web-inf folder.
I had to create my own ResourceLoader, a very small interface. I
called it ServletContextResourceLoader. You need to give it the
ServletContext. To make it easier on my application, I also defined a
'mount point' so that 'mytemplate.vm' could be used. Of course,
without that, you would need the full path relative to the context
directory.
You register is like this:
engine = new VelocityEngine();
engine.setProperty(VelocityEngine.RESOURCE_LOADER, "resourceLoaderAdapter");
engine.setProperty("resourceLoaderAdapter.resource.loader.instance",
new ServletContextResourceLoader(servletContext));
Now that I am writing this, I am recalling that I had difficulty using
a properties file to configure the engine - how can the ServletContext
instance be given to the ResourceLoader instance?
adam
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]