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: how to use custom velocity.properties
Date Tue, 03 Jul 2001 10:20:57 GMT
daljeetsingh wrote:
> 
> Hello
> 
> I need to use a custom velocity.properties file for all the servlets in
> a web application.
> 
> In order to do that I added the following to the web.xml
>     <servlet >
>       <servlet-name>org.apache.velocity.servlet.VelocityServlet</servlet-name>
>       <servlet-class>org.apache.velocity.servlet.VelocityServlet</servlet-class>
>       <init-param>
>          <param-name>properties</param-name>
>          <param-value>velocity.properties</param-value>
>       </init-param>
>     </servlet>
> 
> This change has not been sufficient for the velocity servlet to use the
> custom properties file in the loadConfiguration method ??
> 
> What's wrong?

1) I would change <servlet-name> to something else, like 'MyServlet', so
you can 

   http://....../yourwebapp/servlet/MyServlet

in the browser

2) you will need to extend VelocityServlet, so the <servlet-class> much
change to your class that extends VelocityServlet.

3) the properties params are right - put the velocity.properties file in
your webapp root (i.e  webapps/webappname/ ).

See examples/servlet_example2 for some ideas on working with properties.

geir



-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Mime
View raw message