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