velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Velocity w Tomcat Prob
Date Thu, 15 Feb 2001 18:25:36 GMT
mlecza@amsnet.com wrote:
> 
>  I am evaluating Velocity with servlets (using the Tomcat 3.2 servlet
>  engine).
> 
>  I get the follwoing erro running the SampleServlet:
>  Error processing the template
>  Cannot find the template!
> 
>  The sample.vm file is in the same location as the SampleServlet.class file
>  (under WEB_INF/classes).  Is this the wrong place?  Is there somewhere I
>  have to config the template path?  Is there a Velocity/Tomcat setup
>  wlakthrough anywhere?


Take a look at the documentation on the site
http://jakarta.apache.org/velocity.


The upshot is that velocity must be configured to find the template.  
There is a property 
resource.loader.1.resource.path = <directory>

through which you can set where vel looks for the template.  The default
is the 'current directory', which for the servlet engine, is whatever
directory you were in when you started tomcat.

You can :

1) put the template in the current directory from where you start
tomcat.  This is the fastest way to see something, but a horrible
configuration approach :)

2) Make a file, velocity.properties, place it into the root directory of
your webapp, and put the property in there.  Then, follow the directions
in 

http://jakarta.apache.org/velocity/developer-guide.html

on how to work with servlets. The docs aren't spectacular, but should
give you a good idea. 

The velocity.log is also a great source for information - it will tell
you where the resource loader is looking to load templates.

good luck.  come back if you still have problems.  All of the vel
developers use Tomcat, so it certainly works well with Velocity. ;)

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Mime
View raw message