You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by James Closs <ja...@bitbull.com> on 2005/08/15 17:47:17 UTC
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: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: newbie - can't get VelocityServlet to read configuration file
Posted by Nathan Bubna <nb...@gmail.com>.
my recommendation would be to not use the VelocityServlet. it's
deprecated and scheduled for removal from Velocity. it's replacement
is the VelocityViewServlet in the VelocityTools project
(http://jakarta.apache.org/velocity/tools/index.html). it has
ready-to-run examples (packaged as WAR files) that you can tweak and
use as a base, and it is much more user friendly than the
VelocityServlet. you'll find most of VelocityTools very useful in
designing web applications. :)
On 8/15/05, James Closs <ja...@bitbull.com> wrote:
> 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: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org