In the deployment descriptor (web.xml) we supply the initialization parameters to the Servlet as follows.
<init-param>
<param-name>name</param-name>
<param-value>value</param-value>
</init-param>
Servlet container reads the parameters and supplies them to the Servlet using ServletConfig object. We call getlnitParameter method on the config object in the Servlet to retrieve the param values. For example, init method can be implemented as follows, public void init(ServletConfig config) throws ServletException
{
String value=config.getInitParameter("name");
}
Whatever name is given to the parameter in the DD file that name should be supplied to the getlnitParameterName method. It returns the value specified in the DD file as a String object. We can supply any number of init-prams to a Servlet.
