Re: T5: Using resources

2008-02-22 Thread Hugo Palma
I think the problem is that your referecing your template by path and not by it's place in the classpath. Velocity.getTemplate("templates/description.vm"); should work. MoritzGilsdorf wrote: > Hi, > > I have that. Here is my code: > > props.setProperty(VelocityEngine.RESOURCE_LOADER, "classpat

Re: T5: Using resources

2008-02-22 Thread Angelo Chen
Hi, my deployment is also packaged into jar file under WEB-INF/lib, except i don't have the templates directory, in my case the *.vm files are in the place where log4j.properties is, try to move those *.vm files into that place and see if velocity can find it. a.c. MoritzGilsdorf wrote: > >

Re: T5: Using resources

2008-02-22 Thread MoritzGilsdorf
Then I get: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'description.vm' Obviously Velocity can't find the template because in my deployment it is packaged in the jar file under WEB-INF/lib . Angelo Chen wrote: > > how about just : > > emplate template =

Re: T5: Using resources

2008-02-22 Thread Angelo Chen
how about just : emplate template = Velocity.getTemplate("description.vm"); MoritzGilsdorf wrote: > > Hi, > > I have that. Here is my code: > > props.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath"); > props.setProperty("classpath." + VelocityEngine.RESOURCE_LOADER + > ".class",Class

Re: T5: Using resources

2008-02-21 Thread MoritzGilsdorf
Hi, I have that. Here is my code: props.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath"); props.setProperty("classpath." + VelocityEngine.RESOURCE_LOADER + ".class",ClasspathResourceLoader.class.getName()); engine.init(props); Then I load my template with this: Template template = Velo

Re: T5: Using resources

2008-02-21 Thread Angelo Chen
Hi, here is what I did: store it under resources, then add: p.setProperty("resource.loader", "class"); p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); engine.init(p); MoritzGilsdorf wrote: > > Hi, > > I'm trying to find