The “context-param” tag is define in “web.xml” file and it provides parameters to the entire web application.

For example, store administrator’s email address in “context-param” parameter to send errors notification from our web application.

web.xml

<context-param>
    	<param-name>AdministratorEmail</param-name>
    	<param-value>mkyong2002@yahoo.com</param-value>
</context-param>

We can get the above “AdministratorEmail” context-param value with the following java code.

String email= getServletContext().getInitParameter("AdministratorEmail");

Result

mkyong2002@yahoo.com