| Author |
Init() vs. Constructor
|
Tanzeem Akhtar
Greenhorn
Joined: Sep 11, 2007
Posts: 9
|
|
Hi guys, Well can you tell me that why there is need of "init()" , i mean why can not we initialize the servlet object with the help of constructors? Thank you.
|
Tanzy..
http://techythought.wordpress.com/
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
Recall that a servlet is NOT a stand alone application. It has to operate in the context of the servlet container. Therefore you would either have to always provide a constructor taking the ServletConfig or define an API that uses init() - the convention of a no-args constructor and an init method for objects operating in a container is used in Applets and other Java APIs - predating the servlet API. So servlets are just following an established pattern. Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Init() vs. Constructor
|
|
|