Keng Wong wrote:
> 
> I am trying to load the velocity.properties file from the context instead of
> from each servlet declaration (<servlet><init-param>...):
> <web-app>
>   <context-param>
>     <param-name>properties</param-name>
>     <param-value>/WEB-INF/conf/velocity.properties</param-value>
>   </context-param>
> </web-app>
> 
> I can't seem to load the file at all. However, putting that in a
> <init-param> within a <servlet> tag works. Any way around this ? I had a
> couple of servlets that extends VelocityServlet and do not wish to add the
> mappings for each servlet.

I was playing with this, and couldn't get it to work either w/ Tomcat
3.2.1 - however, I didn't play very long.

Once strategy that I use to solve this problem is in your webapp
specific web.xml in WEB-INF, I make one of the servlets
<load-on-startup>, so it takes care of the Velocity initialization for
you.

You only need to do it once - once any of your servlets initializes
Velocity in a webapp, then the Velocity runtime will be ready for all. 
Thats why the single servlet <load-on-startup> technique works.


geir

-- 
Geir Magnusson Jr.                           [EMAIL PROTECTED]
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Reply via email to