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:

  • The database properties like database name configuration propety. It will be mostly configured as context init-param
  • And if you want to set property value which derives based on runtime changes, like "last user logged in" or "number of failures" should be context attributes.

'etc' 카테고리의 다른 글

oracle charset change  (0) 2016.10.21
Session  (0) 2016.09.29
[Freemarker] number format 설정  (0) 2016.06.29
OSI 7계층  (0) 2016.04.29
IPv4/IPv6  (0) 2016.04.29

+ Recent posts