jump to navigation

Servlet Config August 23, 2005

Posted by Coolguy in Servlets/Jsp.
trackback
  • When container initializes a servlet it makes a unique ServletConfig for the servlet
  • The container reads the servlet init parameters from the deployment descriptor and gives them to the ServletConfig and then passes ServletConfig to the servlet’s init() method
  • There is one version of init which takes a ServletConfig as a parameter and there is one which doesn’t
  • Developers typically override the no-arg version as the arg version calls the no-arg version !!
  • Once the parameters are in ServletConfig, container never reads the init parameters again till the servlet is redeployed.
  • E.g:
    <init-param>
    <description>test parameter
    <param-name>myname
    <param-value>DummyValue
    </init-param>
    String name=ServletConfig.getInitParameter(“myname”);
    Enumeration e= getServletConfig().getInitParameterNames();
Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: