You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by SoftLiban KEYROUZ Charbel <ch...@softsolutions.fr> on 2000/07/26 17:15:42 UTC
How to use the tag in web.xml?
Hi all,
I have a simple question:
How can use the <servlet> tag in web.xml to pass the configuration file
(the configuration file holds the database name, username and password)
to my ConnectionPool servlet and afterwards once in the servlet how
can I read this configuration file.
If this is correct what is code I should use to read the configFile. I
know it has something to do with ServletConfig class but I have no clew
how to use it. Are there some example you could point out to me?
<servlet>
<load-on-startup>
-2147483646
</load-on-startup>
<servlet-name>
ConnectionPool
</servlet-name>
<servlet-class>
softsolutions.connection.pool.ConnectionPoolInit
</servlet-class>
<init-param>
<param-name>configFile</param-name>
<param-value>snaDbPool.prop</param-value>
</init-param>
</servlet>
Thank you in advance
Charbel Keyrouz.
Re: How to use the tag in web.xml?
Posted by Tim Kientzle <ki...@acm.org>.
Within your servlet's init, doGet, or doPost methods,
you can call
getServletConfig().getAttribute("configFile")
to access these parameters.
- Tim Kientzle
SoftLiban KEYROUZ Charbel wrote:
>
> Hi all,
> I have a simple question:
> How can use the <servlet> tag in web.xml to pass the configuration file
> (the configuration file holds the database name, username and password)
> to my ConnectionPool servlet and afterwards once in the servlet how
> can I read this configuration file.
> If this is correct what is code I should use to read the configFile. I
> know it has something to do with ServletConfig class but I have no clew
> how to use it. Are there some example you could point out to me?
> <servlet>
> <load-on-startup>
> -2147483646
> </load-on-startup>
> <servlet-name>
> ConnectionPool
> </servlet-name>
> <servlet-class>
> softsolutions.connection.pool.ConnectionPoolInit
> </servlet-class>
> <init-param>
> <param-name>configFile</param-name>
> <param-value>snaDbPool.prop</param-value>
> </init-param>
> </servlet>
>
> Thank you in advance
> Charbel Keyrouz.