velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai Schlichting <laccolithgr...@gmx.de>
Subject WebappResourceLoader: ResourceNotFoundException
Date Sun, 18 Jan 2009 16:18:36 GMT
Hi!

I tried to get Velocity working with WebappResourceLoader for a web project.
My current code:

Properties props = new Properties();
props.setProperty("resource.loader=webapp", "webapp");
props.setProperty("webapp.resource.loader.class",
"org.apache.velocity.tools.view.WebappResourceLoader");
props.setProperty("webapp.resource.loader.path",
"/WEB-INF/classes/my/package");
VelocityEngine ve = new VelocityEngine(props);
ve.init();
Template t = ve.getTemplate( "my.template.vm" );

I only want to use Velocity right now at one place and would like to set the
properties in the code (with no configuration file). Although "C:\Program
Files\Apache Software Foundation\Tomcat
6.0\webapps\my_project\WEB-INF\classes\my\package\my.template.vm" exists, I
get a ResourceNotFoundException when calling getTemplate - what am I doing
wrong?

Thx!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message