our replies crossed in the mail.  hopefully my last email answers this
question, but it can't urt to repeat...

the VVS has always used the webapp resource loader by default.  this
is set programmatically in the initVelocity() method and requires no
user intervention or custom velocity.properties.  it is one of the key
benefits of the VVS, because it makes it far more portable and doesn't
require any configuration for use in webapps.

if you want it to use the FileResourceLoader, you must override that
setting in a custom velocity.properties as such:

resource.loader=file
file.resource.loader.class=blah.blah.FileResourceLoader
file.resource.loader.path=/blah/blah/templates

if you want to just use the FileResourceLoader along with the default
webapp loader, then you should just change the resource.loader
property above to:

resource.loader=file,webapp
...

this sort of stuff (multiple resource loaders) is fairly well
documented in the velocity dev guide and such.

On 4/14/05, Will Glass-Husain <[EMAIL PROTECTED]> wrote:
> Here's a question for VVS users - is webapp resource loading on by default?
> 
> I just don't get how the FileResourceLoader knows to go from the base of the
> web template.  I'm thinking that it's not being used at all.
> 
> 
> WILL
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> Sent: Thursday, April 14, 2005 1:58 PM
> Subject: Re: Problem with decimal in most recent snapshot
> 
> >
> > Something I am just noticing.  When I have commented out
> > webapp.resource.loader.class, the general templating works for web
> > browsing.   It works off of the base web root.
> >
> > When I put back in
> >      webapp.resource.loader.path = /WEB-INF/templates
> > Velocity seems to disregard the base web root for all processing and I get
> > the ResourceNotFoundException found at the bottom.
> >
> > This seems to work with Will's idea on full path, but shouldn't it still
> > use the file.resource.loader.path for web browsing?  As soon as I take out
> > the webapp.resource.loader.path it goes back to using path relative to the
> > web root.
> >
> > I always need to use a path relative to the web root in both cases if
> > possible.  I am going to mess around with paths now and see if I put in
> > the full path it works.
> >
> > JohnE
> >
> >
> >
> > org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> > resource '/WEB-INF/templates/pub/common/tiles/defaultTemplate.vm'
> > at
> > org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:463)
> > at
> > org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
> > at
> > org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:835)
> > at
> > org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:817)
> > at
> > org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:504)
> > at
> > org.apache.velocity.tools.view.servlet.VelocityViewServlet.getTemplate(Unknown
> > Source)
> > at
> > org.apache.velocity.tools.view.servlet.VelocityViewServlet.handleRequest(Unknown
> > Source)
> > at
> > org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(Unknown
> > Source)
> > at
> > org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(Unknown
> > Source)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
> > at
> > org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
> > at
> > org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
> > at
> > org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:237)
> > at
> > org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:300)
> > at
> > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
> > at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to