aspose file tools*
The moose likes Servlets and the fly likes Servlet Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Constructor" Watch "Servlet Constructor" New topic
Author

Servlet Constructor

kamlesh tayade
Ranch Hand

Joined: Sep 21, 2005
Posts: 34
As Servlet is the java class. Is servlet having constructor? If yes then can we overried it else then why it is not.


Kamlesh
Be oN edGE SCJP 1.4, on edGE for SCWCD 1.4
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"kamlesh"

Please see the previous request to change your display name.

We require display names to be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please correct your display name, since accounts with invalid display names get deleted.

thanks,
Dave
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Your question is answered (eventually) in this thread.

A summary is: Yes you can, but the container only looks for the no-arg constructor. If you do not provide one a Servlet instance will not be created by the container.
Talha Bin Hussain
Greenhorn

Joined: Feb 12, 2006
Posts: 6
Hello,

A servlet requires info about the server which the server provides thru
the ServletConfig object, so there should be a method in the servlet
which accepts this argument from the server.

But this cannot be a constructor as a servlet is basically an interface
and an interface cannot have constructors. So it should be some other
method. Hence the method init()
 
Consider Paul's rocket mass heater.
 
subject: Servlet Constructor