Landaluze Produktions IS - Carlos wrote:
> i have a class file in the WEB-INF/classes/BD directory and the file's name
> is conection.class
> is possible to init this classfile with a values?
> how can i configure it in the web.xml file?
> i want to init this file with a default values. is this possible?
> thanks
> CArlos
>
In a servlet 2.2 environment (i.e. Tomcat 3.x), the most practical way to do
this is to create a servlet to do the initialization, and mark it
<load-on-startup> in the web application deployment descriptor. In the init()
method of your servlet, you could use the servlet initialization parameters of
the startup servlet to configure your class. This is a common approach for
initializing JDBC connection pool classes, for example.
In a servlet 2.3 environment (i.e. Tomcat 4.0), you also have the option to use
the new "application event listener" capability. If your class implements the
javax.servlet.ServletContextListener interface, and you register it as a
<listener> in the web application deployment descriptor, the
contextInitialized() method will be called when your web application is
initialized. You can then use servlet context initialization parameters with
specific names to initialize the properties of your listener class.
For details on the required APIs, see the servlet specification (and associated
JavaDocs) at:
http://java.sun.com/products/servlet/download.html
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]