Page 1 of 1

About Question enthuware.jwpv6.2.810 :

Posted: Thu Nov 22, 2012 3:03 pm
by tori3852
Option is marked as incorrect:
They can be modified using the setInitParameter() method.
Not sure about this – ServletContext has setInitParameter method, but it is only allowed to be set during initialization. Same with Servlet init parameter.

By the way – on Tomcat 7 I was able to set new context/servlet init parameters in servlet's service() method (which is wrong according to API), but I guess this is Tomcat specific.

Re: About Question enthuware.jwpv6.2.810 :

Posted: Sun Nov 25, 2012 11:21 am
by admin
Yes, the setInitParameter method can be used only before the servlet is initialized.
Also, as per the javadoc, it returns false if it was not set because this ServletContext already contains a context initialization parameter with a matching name. That means it cannot be modified.

-Paul.