Everett said: > Hi, I'm looking for a concrete usage example for the WebappLoader. I've > checked the mail archives and examples but haven't found anything more > than bits and pieces.
hmm. i suppose the VelocityViewServlet is really the only "concrete" public example using the WebappLoader (that i know of). > What properties do I need in the properties file? > e.g. > resource.loader = webapp > webapp.resource.loader.class = > org.apache.velocity.tools.view.servlet.WebappLoader > webapp.resource.loader.path = WEB-INF/templates these look fine to me. but, you do also need to put the ServletContext into velocity's application attributes (see below) so that the WebappLoader has a way to actually load things. > How do I know Velocity.init(Properties) is even using these? well, you look at the log output and/or just see if it works... not sure what you're hoping for here... > What java code would I need? you need to manually put the ServletContext into the app attributes before the WebappLoader is initialized (i.e. *before* Velocity.init() gets called). it might look something like: Velocity.setApplicationAttribute("javax.servlet.ServletContext", myServletContext); Velocity.init(myProps); you might also look at how the VelocityViewServlet does it. > Do I call WebappLoader directly? no, RuntimeSingleton.getTemplate("foo.vm") should use the configured resource loader automatically. Nathan Bubna [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]