This tag provides parameters to the entire context / web application.

Uses include things like defining an administrator email address to send errors from your application, or other settings that are relevant to your application as a whole.

See advantages of specifying parameter values in web.xml for reasons you would want to use this method.

To access the values from your Java/JSP code, use the following syntax:

String value = getServletContext().getInitParameter("parameterName");

A single <context-param> tag is used for each parameter.

The actual parameter name and value are set using <param-name> and <param-value>.

Example usage in web.xml:

    <description>The email address of the administrator, used to send error reports.</description> 

With the above example, you can extract the value of the webmaster parameter with:

String value = getServletContext().getInitParameter("webmaster");

See Also

metawerx specific

referring pages