velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lacco <laccolithgr...@gmx.de>
Subject Re: WebappResourceLoader: ResourceNotFoundException
Date Mon, 19 Jan 2009 20:44:19 GMT

Okay, it works now: The init method shouldn't be called at all when setting
properties by hand... Besides, the servlet context has to be set. My final
version:

VelocityEngine ve = new VelocityEngine();
ve.setApplicationAttribute("javax.servlet.ServletContext", servletContext);
ve.setProperty("resource.loader", "webapp");
ve.setProperty("webapp.resource.loader.class",
"org.apache.velocity.tools.view.servlet.WebappLoader");
ve.setProperty("webapp.resource.loader.path",
"/WEB-INF/classes/de/hpi/petrinet/serialization/erdf");
Template t = ve.getTemplate( "petrinet.erdf.vm" );

Thx for the hint with the init method! Some more literature:
http://velocity.apache.org/engine/devel/webapps.html

Another Thing: The JavaDoc talk about not to use
"org.apache.velocity.tools.view.servlet.WebappLoader" in Velocity Tools 2.X,
but I can't find any stable version. So I am just using velocity tools 1.4,
are there more up-to-date versions out there?
-- 
View this message in context: http://www.nabble.com/WebappResourceLoader%3A-ResourceNotFoundException-tp21548077p21551182.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message