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]



Reply via email to