Found something unexpected.

I have attached an ear to illustrate.

In the servlet TestServlet (config provided for expediency).
        <servlet>
                <servlet-name>test</servlet-name>
                <display-name>test</display-name>
                <servlet-class>com.sequenet.mvc.TestServlet</servlet-class>
                <init-param>
                        <param-name>config</param-name>
                        <param-value>test</param-value>
                </init-param>
                <load-on-startup>1</load-on-startup>
        </servlet>
I try to get an init-param three ways.

    System.err.println("param="+getInitParameter("config"));
    System.err.println("param="+config.getInitParameter("config"));
    System.err.println("param="+getServletContext().getInitParameter("config"));

the first two print "test" as they should.
the last one print "null".

why?

Just for kicks I performed this test in both the init() method and a service()
method.

Any thoughts?

WR
Russ White

test.ear

Reply via email to