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.
Author and all-around good cowpoke
Joined: Mar 22, 2000
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.