Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.6.4
-
None
Description
I spent whole day fighting with my first "hello world" VelocityViewServlet-based servlet. I was struggling with:
org.apache.velocity.exception.ResourceNotFoundException
For following dumb code:
protected Template getTemplate(HttpServletRequest request, HttpServletResponse response) {
return getTemplate("test.vm");
}
1) http://velocity.apache.org/engine/releases/velocity-1.6.4/developer-guide.html#Velocity_Configuration_Keys_and_Values
claims following:
resource.loader = <name> (default = file)
As the result I was trying to use following configuration:
file.resource.loader.path = WEB-INF/vmtemplates
2) http://velocity.apache.org/engine/releases/velocity-1.6.4/developer-guide.html#Configuring%5FResource%5FLoaders
doesn't mention "webapp" (which seems to be default btw)
The correct solution for me was to change
file.resource.loader.path = WEB-INF/vmtemplates
to
webapp.resource.loader.path = WEB-INF/vmtemplates
I don't know Velocity enough yet, so can not really write correct docs. Would be great if someone could clear this part.