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: feature suggestion
Date Tue, 06 Mar 2001 18:26:41 GMT
David Esposito wrote:
> 
> Can you have the init() method default to a "properties" init param in the
> context if one is not defined in the servlet tag? That is, what I've done
> for most of my application is put all of my parameters in the context ...


[SNIP]

I am probably not answering your question, but I think I know what you
want, and there is a conventional way to do it that doesn't require any
code change.

You don't need it in every servlet in the descriptor. Just do it in one,
and put in 

  <load-on-startup>1</load-on-startup>

and the that servlet will be instantiated and have it's init(
ServletConfig ) method called. Since you only need one call to
Runtime.init() to configure Vel, this works just fine.

I use this myself in production, cuz the whole <param> thing got boring
:)

ex :
<servlet>
    <servlet-name>ContentCtrl</servlet-name>
    <servlet-class>com.ridersonline.servlet.ContentCtrl</servlet-class>
    <init-param>
      <param-name>properties</param-name>
      <param-value>velocity.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>


Does that solve it?

geir




-- 
Geir Magnusson Jr.                               geirm@optonline.com
Developing for the web?  See http://jakarta.apache.org/velocity/

Mime
View raw message