Hi guys.. Well can u 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.

Answer Posted / archana

When u create a servlet with a constructor it wont be a
complete servlet but will be in a akward state where it
cannot access Servlet Context and Config.It has to go
through the init() method (though we dont know what code is
written there) to be a complete servlet

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to rectify errors in java servlet while compilation?

515


What methodology can be followed to store more number of objects in a remote server?

1813


What is cgi and what are its drawbacks?

549


What are all the protocols supported by httpservlet?

646


What is java servlet?

604






What is called Scriptlet?

555


Explain the role of dispatcherservlet and contextloaderlistener.

601


Explain session tracking and its importance?

542


What is the difference between the include() and forward() methods?

565


What do you mean by cgi in servlet?

624


List the Different types of servlet?

577


What is the difference between servlet and filter?

522


Why is http protocol called as a stateless protocol?

533


What is the process for chaining servlet?

607


What is ServletContext object?

639