This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have read the headFirst jsp and servlet but still not clear about this ....
Prashant Chindhade
Ranch Hand
Joined: Jan 19, 2011
Posts: 77
posted
0
The constructor is called by the container simply to create a POJO (plain old java object).
init method is the method which is invoked when servlet in called and it adds values to the servlet context so its a very much difference between constructor and init method...
prashant chindhade wrote:The constructor is called by the container simply to create a POJO (plain old java object).
init method is the method which is invoked when servlet in called and it adds values to the servlet context so its a very much difference between constructor and init method...
regs
Prashant
It's not when the servlet is called but initialized. And it happens only once, as I told you in a different thread.
The init() method is used to initialize a servlet as it has access to the ServletConfig instance while the constructor does not. This has been asked many tomes before. Please SearchFirst before posting.