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 .




-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED] On Behalf Of Duc Vo
Sent: Thursday, September 01, 2005 12:13 PM
To: SERVLET-INTEREST@JAVA.SUN.COM
Subject: Re: Servlet Init method

In my opinion, it's because that developer can only write one public void
init() method but several public constructors of a servlet. There will be no
guarrantee that which constructor will be used by the container, hence the
J2EE STANDARD to use init method to initialise the servlets.

________________________________

From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. on behalf of Senthil_Theerthagiri
Sent: Thu 05/09/01 4:25 PM
To: SERVLET-INTEREST@JAVA.SUN.COM
Subject: Servlet Init method



Hi,



                I am a beginner in servlet programming. . I have a question
in that. Can anybody clear it for me?



                Why do we have init() method instead of constructor. Bcaz
servlet is also a java class file, so why don't we use constructor instead
of init().



Regards
SenthilKumar Theerthagiri
Satyam Computers Chennai.
Ph: 24353221 - Ext: 3709



-- You  can do everything, if it's important enough to you to do.



DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated..

___________________________________________________________________________
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

___________________________________________________________________________
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

Reply via email to