Hi,
Is it possible to configure a set of parameters for all servlets in a given
context?
Say I have 2 servlets in a context A and B:
<servlet>
<servlet-name>A</servlet-name>
<servlet-class>A</servlet-class>
<init-param>
<param-name>db</param-name>
<param-value>TestDB</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>B</servlet-name>
<servlet-class>B</servlet-class>
<init-param>
<param-name>db</param-name>
<param-value>TestDB</param-value>
</init-param>
</servlet>
This obviously get's a bit out of hand (I'd like to avoid a property file).
What I want to say is "For all servlets in this context db = TestDB"?

Signature
Regards
Sean Clarke
-------------------------------------------------
Linux.... for those whose IQ is greater than 98 !!
Neil Green - 10 Oct 2003 15:44 GMT
> Is it possible to configure a set of parameters for all servlets in a given
> context?
[snip]
> What I want to say is "For all servlets in this context db = TestDB"?
How about
<web-app>
...
<context-param>
<param-name>db</param-name>
<param-value>TestDB</param-value>
</context-param>
...
</web-app>
to set the parameter for the context.
Then using getServletContext().getInitParameter( "db" )
HTH
Neil