Why would we set ServletContext parameters using the setAttribute()
method, as we can accomplish the same thing by setting parameters in web.xml
an
The servletContext.setAttribute()
is dynamic which can be set and reset during runtime.
Where as init-parameter
specified in web.xml
is static which will not change during the lifetime of application.
Example:
init-param