hi,

I had the same problem. I overcame it by giving something like

getServletContext("context_name").getInitParameter().Please check the exact
syntax from the servlet api

Now I am using a static class to hold all the initial values in a hashtable.
In the static initializer, I am populating
the hashtable with values from a database.

regards

-----Original Message-----
From: Ariel [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 8:10 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Defining an init parameter for all servlets



I tried to use the <context-param> tag in web.xml:

<web-app>
  <context-param>
    <param-name>foo</param-name>
    <param-value>bar</param-value>
  </context-param>
<web-app>

getInitParameter("foo") returns null

Tomcat version: 3.2.1 for Win32

Ariel

-----Original Message-----
From: Kitching Simon [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 7:52 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Defining an init parameter for all servlets


> -----Original Message-----
> From: Ariel [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, January 15, 2001 6:52 PM
> To:   '[EMAIL PROTECTED]'
> Subject:      Defining an init parameter for all servlets
>
>
> I would like to define some initialization parameters to be used by
> all servlets running on Tomcat.
> Is there a way to define this in web.xml, besides copying the <init-param>
> section of the global parameter to every servlet's section in web.xml?
[Kitching Simon]  Yep!

To set a parameter accessable by all servlets
*in a web application*, see "context-param" tag
(or is it config-param?) in the sun servlet specification...

>
> Ariel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to