ServletContext can be configured in web.xml and it will be accessible to all servlets in the web application. It is specified as mentioned below
<context-param>
<param-name>adminEmailAddress</param-name>
<param-value>admin@admin.com</param-value>
</context-param>
The value of every specified parameter can be loaded in the servlet code, referenced by the parameter name:
String value = getServletContext().getInitParameter("adminEmailAddress");
<context-param>
<param-name>adminEmailAddress</param-name>
<param-value>admin@admin.com</param-value>
</context-param>
The value of every specified parameter can be loaded in the servlet code, referenced by the parameter name:
String value = getServletContext().getInitParameter("adminEmailAddress");
No comments:
Post a Comment