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

How many servlet objects are created?

561


What are the different methods involved in generic servlet?

553


What mechanisms are used by a Servlet Container to maintain session information?

666


What are advantages of servlets over cgi?

624


List out the difference between ServletConfig and ServletContext?

600






Explain the difference between servletconfig and servletcontext in servlet?

565


What is webservlet?

531


Why do we have servlet filters?

595


What do you mean by session tracking and also explain its techniques?

497


How to get the server information in a servlet?

683


How is a servlet implemented in code?

566


What’s the difference between sendredirect and forward methods

564


What is the purpose of requestdispatcher interface?

610


What is the difference in between the httpservlet and generic servlet?

601


What are session variable in servlets?

564