You need a ServletContextListener, and you can get to them from there.
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Shankar Unni
Sent: Monday, December 27, 2004 5:47 PM
To: [email protected]
Subject: How to access <web-app> <context-param>s from Servlet.init()?
I'd like to configure a set of web-app-level parameters for use by both
Java-based Servlets, and JSP pages. I thought of setting these up as
<context-param>s at the <web-app> level in web.xml.
For JSPs, all is cool: <%= application.getInitParameter("foo") %>
returns these parameters.
For Servlets, how do I get at them from the init() method? (I need them
there!). I find that calling config.getInitParameter() doesn't return
these (where "config" is the parameter to init() - it only returns the
actual <init-param>s configured within the <servlet>).
Also, this.getServletConfig() is null, and this.getServletContext()
throws an NPE from within javax.servlet.GenericServlet.
(All this with Tomcat 5.0.27).
How do I get at a <context-param> from within Servlet.init()?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]