servletContext.setAttribute() is dynamic, which can be set and reset at runtime.
Where indicated, the init-parameter specified in web.xml is static, which will not change throughout the life of the application.
Example:
- Database properties, such as propety database configuration. It will be mainly configured as
init-param context - And if you want to set the value of a property that occurs based on changes at runtime, for example, "last user logged in" or "number of failures" should be context attributes.
Ramesh PVK Jun 15 '12 at 8:01 2012-06-15 08:01
source share