I have same problem with WebApp loader, while template is copied in every folder of webapp, it's still not found. I think it might be bug (?) in Velocity, trying to load VM_global_library.vm instead of my template and always returning "not found"
On 7/12/07, Malcolm Edgar <[EMAIL PROTECTED]> wrote:
Please look at the WebappLoader which is a part of the apache Velocity Tools project is great for web applications. Otherwise you can try the Click Framework, which has all this stuff built in. regards Malcolm Edgar http://click.sourceforge.net/ On 7/12/07, Joe Kramer <[EMAIL PROTECTED]> wrote: > > Hello, > I've spent good 10 hours trying to load template in webapp. > First I tried > resource.loader= file > and putting template into any posible directory, WEB-INF, classes, > lib, web app root. > Also tried to use > resource.loader=class > Putting template in all possible places. Including create template.jar > and putting it in /lib. > It's always "Unable to find resource 'template.vm'" > > So I nothing helps using out-of-the-box methods. > I wrote class ResourceLoader extends > org.apache.velocity.runtime.resource.loader.ResourceLoader > > and put resource.loader=custom > > I added Log message into getResourceStream(), the method to be called > when template is requested. > Java code: > VelocityEngine ve = new VelocityEngine(); > ve.init(); > Template template = Velocity.getTemplate("template.vm"); > > What do I get in log: > INFO - getResourceStream() load VM_global_library.vm > ERROR - Unable to find resource 'template.vm' > > It looks for VM_global_library.vm! Why??? > In velocity.properties it's even commented out: > # velocimacro.library = VM_global_library.vm > And VM_global_library.vm is present in path just in case. > I don't get any messages that VM_global_library.vm not found, I gt > message that requested template not found but request to > ResourceLoader wasn't made for that template. > > How do find template resources in webapp? > Why even that I implemented my own resourceLoader, it looks for > VM_global_library.vm and returns that requested template not found? > > Thanks. > > --------------------------------------------------------------------- > 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]