how a servlet is instantiated, whether the container calls
init() or by calling any other method? please somebody reply..

Answer Posted / ashutosh

Servlet is instantiated by servlet container by calling
method Class.forName(Servlet class name).newInstance();

First of all Servlet Container looks into the
deployment descriptor(web.xml) .It looks the definition of
Servlet.And Than instantiate it by calling
Class.forName(Servlet class name).newInstance();

Is This Answer Correct ?    19 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we use the constructor, instead of init(), to initialize servlet?

586


Why the container loads server at the application startup and how?

585


How httpservlet is different from the genericservlet?

568


Is that servlet is pure java object or not?

644


What are the steps that are involved in using the httpservlet class?

578






What is the life-cycle of servlets?

638


What do you mean by cgi?

534


What are different ways for authentication of servlet?

531


Which protocol will be used by browser and servlet to communicate

584


When servlet is loaded?

596


How can the referrer and the target urls be used in servlet?

538


Describe the phases of servlet lifecycle?

634


What is Servlets and explain the advantages of Servlet life cycle?

585


Is it good idea to create servlet constructor?

747


Servlet is pure java object or not?

721