velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Byron Foster <by...@base2.cc>
Subject Re: WebappResourceLoader: ResourceNotFoundException
Date Tue, 20 Jan 2009 07:12:46 GMT

On Jan 19, 2009, at 13:44 , lacco wrote:

> 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" );

Yea, I think this is confusing.  Calling the non default constructors  
for VelocityEngine calls the init() method, but calling the default  
constructor does not. So, if you call VelocityEngine(props) then you  
can't set any more properties after that point.



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


Mime
View raw message