No, there are no constructors and destructors in servlets. But there are two
methods init() and destroy() that can be used as constructor and destructor
respectively.
When servelt's instance is instantiated, init() is called immediately so you
can use it as constructor and you can do default initialization of variables
etc.
When servlet is destroyed, destroy() method is called (ofcourse when webserver
is restarted.) and you can do clean up in this one.
Regards
Farooq Hameed
Sanjay Kumar <[EMAIL PROTECTED]> on 04/27/2000 05:43:40 PM
Please respond to "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Farooq Hameed/CresSoft)
Subject: Constructors in Servlet
Hello friends,
Is it possible to have constructors in Servlets?
If yes when is it called?
Waiting for your valuable suggestion.
Thanks
Sanjay
___________________________________________________________________________
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
___________________________________________________________________________
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