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()?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With