Metawerx Java Hosting Small Logo

<init-param>

This tag provides parameters to a single servlet or filter.

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 = getServletConfig().getInitParameter("parameterName");

A single <init-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, for providing parameters to a servlet:

<servlet>
    <servlet-name>My Servlet</servlet-name>
    <servlet-class>com.foo.BarServlet</servlet-class>
    <init-param> 
        <description>User debug mode, outputs user details on each page</description> 
        <param-name>debugUsers</param-name> 
        <param-value>true</param-value> 
    </init-param> 
</servlet>

See Also

navigation
metawerx specific
search
Share
tools
help

referring pages

Share