servlet has not any main method in it how does it work by
JVM?

Answers were Sorted based on User's Feedback



servlet has not any main method in it how does it work by JVM?..

Answer / srinivasa kumar meda

The life cycle of a servlet is controlled by the container
in which the servlet has been deployed. When a request is
mapped to a servlet, the container performs the following steps.

If an instance of the servlet does not exist, the Web container
1. Loads the servlet class.
2. Creates an instance of the servlet class.
3. Initializes the servlet instance by calling the
init method.
Invokes the service method, passing a request and response
object.

Is This Answer Correct ?    24 Yes 1 No

servlet has not any main method in it how does it work by JVM?..

Answer / ananth

Servlets has init() method to load the initial steps for
loading servlet instance in the server class path at the
first time of the servlet engine has starts.

Is This Answer Correct ?    17 Yes 1 No

servlet has not any main method in it how does it work by JVM?..

Answer / suresh

plese put the correct answers dont say rong number peoples was visiting ths site dont say stupid answers

Is This Answer Correct ?    14 Yes 7 No

servlet has not any main method in it how does it work by JVM?..

Answer / nishita

The request mapping is done in web.xml which maps URL to
the Servlet which should handle the request. When the user
hits the URL on the browser, the request is redirected to
Webserver from the code. The Web container decides which
Servlet to call based on the mapping in Web.xml. This
servlet (if it was not loaded at server startup) will first
get loaded then, it gets instantiated and then its init()
method is called. This is called only once. The
initialization happens here. After that the servlet is
ready for service, service() method is called. The service
() method can be called any number of times. Hence, without
a main method the servlet is called.

Is This Answer Correct ?    6 Yes 0 No

servlet has not any main method in it how does it work by JVM?..

Answer / sk.bilal ahmed

Servlets has work by init() method to load the initial
steps for loading servlet.

Is This Answer Correct ?    4 Yes 2 No

servlet has not any main method in it how does it work by JVM?..

Answer / psreddy

whenever send a request for any resource , First the
webcontainer will recieves the request and after it will
create two objects that objects are request and response
objects then it will match the url pattern in web.xml ,
afer that it creates Servlet Object .

Is This Answer Correct ?    2 Yes 1 No

servlet has not any main method in it how does it work by JVM?..

Answer / amit singh

no man first the constructor will run then the init()
method
which are used to intialization step likee servletconfig
then after service() method for all thread which will
create for the only on instance of servlet
what the mean is it people think that always the instance
of servlet always create when the requst for the particular
servlet but here only the one instance of servlet and the
the service method will excecute for distinct request
ao don't ever think that

note: that the constructor is default constructor you are
no able to call this constructor
so first the constructor will run
this servlet object it just a noraml object
but after the servletcofig it will be the servlet object
so the constructor will run
thanks
amitsing2008@gmail.com
amit09mca(scjp1.5 and many more)

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More J2EE Interview Questions

What is urn?

0 Answers  


What is component-managed sign-on ?

0 Answers  


Is java a high level language?

0 Answers  


What is j2ee architecture?

0 Answers  


what is the difference between Tomcat 4 & Tomcat 5?

6 Answers   IBM, TCS,






What is a java applet?

0 Answers  


What is javafx java?

0 Answers  


What is build file?

0 Answers  


What are the components of the java platform?

0 Answers  


How does javac compiler work?

0 Answers  


Is java is fully object oriented?

0 Answers  


What do you understand by a thin client?

0 Answers  


Categories