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: Problem in TOMCAT... URGENT
Date Tue, 12 Mar 2002 09:53:40 GMT
On 3/12/02 2:50 AM, "Rangaraj.T@lntinfotech.com"
<Rangaraj.T@lntinfotech.com> wrote:

[SNIP]
> 
> velocity.properties file
> ********************
> 
> #
> # we are taking advantage of the fact that the file
> # resource loader is the default loader
> #
> file.resource.loader.path = WEB-INF/templates
> runtime.log = WEB-INF/velocity.log
> 
> 
> ---------------------
> 
> Could anyone help me on how to do the configuration for web.xml and
> velocity.properties file?
> 

First thing is to make sure that the properties file is getting read - you
can look at the log output at the beginning to see what template path it is
using.

Assuming that all is well, my guess is that your servlet is setting that
path directly, and that is the root of the problem.  Velocity, being a
general purpose template engine, doesn't know about webapps or tomcat, so
when you configure Velocity for use in Tomcat, you need to do a little work.
If you are using the file resource loader, this means that you have to
convert from the relative path to an absolute path - take a look at the
examples/servlet_example2 code for a hint on how to do it.

Other alternatives include using the classpath resource loader - which
allows you to put your templates in a jar, drop that jar into WEB-INF/lib
and not have to worry about any configuration after that.  Or take a look at
the WebappResourceLoader in the jakarta-velocity-tools/view project...

geir


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Java : the speed of Smalltalk with the simple elegance of C++... 


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message