I had the same problem with both VelocityServlet and VelocityViewServlet. I had 
to look at the Velocity-source to find out that the following is not correct, 
although the documentation states otherwise: 

   <init-param>
     <param-name>properties</param-name>
     <param-value>/velocity.properties</param-value>
    </init-param>


param-name has to be "org.apache.velocity.properties" and not "properties".

Andy



-----Ursprüngliche Nachricht-----
Von: James Closs [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 15. August 2005 17:47
An: [email protected]
Betreff: newbie - can't get VelocityServlet to read configuration file


Hi,

I've just started working with Velocity under Mac OSX using the book  
'Pro Jakarta Velocity' and am having one problem...

I've set up a simple 'Hello, World' type servlet as a subclass of  
VelocityServlet. It works, but I can't get it to read any sort of  
configuration parameters.

I have in my web.xml file the following:

<servlet>
   <servlet-name>HelloWorldVelocity</servlet-name>
   <servlet-class>
     com.maturus.battletextwww.HelloWorldVelocity
   </servlet-class>

   <init-param>
     <param-name>properties</param-name>
     <param-value>/velocity.properties</param-value>
</init-param>
</servlet>

...and my velocity.properties file (which is in the correct place) is:

resource.loader=file,class

# FILE RESOURCE LOADER
file.resource.loader.class =  
org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = /Developer/jakarta-tomcat-4.1.31/webapps/ 
battletxt/WEB-INF/classes
file.resource.loader.cache = false
file.resource.loader.modificationCheckInterval = 2

# CLASSPATH RESOURCE LOADER
class.resource.loader.class=org.apache.velocity.runtime.resource.loader. 
ClasspathResourceLoader
class.resource.loader.cache=false
class.resource.loader.modificationCheckInterval=1

...however none of these settings appear to impact the velocity  
runtime whatsoever. I presume the <init-param> is being read OK as  
when I change the reference to a file that doesn't exist I get an  
error as one would expect.

Any help much appreciated...


====

James Closs, Director, bitBull Ltd

http://www.bitbull.com

07771 991171

====


---------------------------------------------------------------------
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]

Reply via email to