You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Law Kaikuo <ka...@usa.net> on 2002/03/20 17:44:39 UTC

Re: [newby : reading velocity.properties from web.xml failed]

Hi Carsten Nichte,

  Just set the property 'file.resource.loader.path' in velocity.properties of
the velocity.jar file to the path where you want to put your template files.
Try it.


  Kaikuo Luo




carsten nichte <ca...@t-systems.com> wrote:
Hi to all,

im new to velocity, and have the typical starting problems:
I want to read te velocity.properties File from the web.xml.

I´ve the following configuration:

My web.xml: (in WEB-INF Folder)
---------------------------------------------
    <servlet>
        <servlet-name>zerf</servlet-name>
        <servlet-class>zerf.ZnSignController</servlet-class>
      <init-param>
        <param-name>properties</param-name>
        <param-value>/WEB-INF/conf/velocity.properties</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>

My velocity.properties: (in WE-INF/conf/)
---------------------------------------------

file.resource.loader.path = /templates
runtime.log = /velocity.log


My servlet does the following:
---------------------------------------------
protected Properties loadConfiguration(ServletConfig config)throws
IOException, FileNotFoundException{

String propsFile = config.getInitParameter(INIT_PROPS_KEY); // where
INIT_PROPS_KEY = "properties"

.. Result: propsFile=null;  // .... so any following code is obsolet... 

This Code-snipplet is from one of the various examples.
I dont´t understand why it doesn´t work.
What does getInitParameter() exactly.

Any solutions ???

Best regards

Carsten Nichte


}




--
To unsubscribe, e-mail:  
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>