Re: Servlet Init method

Nic Ferrier <[email protected]> Thu, 1 Sep 2005 10:03:02 +0100
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
Sreenath N <[email protected]> writes:

> Reason might be init() method needs a ServletConfig object to be passed
> which is used for retreving the init-params and the container can't expect
> the user to write a constructor which takes the ServletConfig object
> .

No. Clearly this is wrong, type checking can enforce that requirement:

   public abstract class Servlet
   {
       public Servlet(ServletConfig sc)
       {
          // do some stuff
       }


       // do some stuff
   }


The reason a servlet has an init method, as opposed to a constructor
is that a constructed instance of a servlet can be deployed and
undeployed from a container several times during it's lifetime.


Nic Ferrier
http://www.tapsellferrier.co.uk

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html