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 does resource adapt module contain?

0 Answers  


What is java awt event?

0 Answers  


Explain j2ee architecture.

0 Answers  


Describe the ear, war, and jar.

0 Answers  


What is the latest technology used in java?

0 Answers  






for example we are login into the irctc server from there it will go to the selected bank and deduct amount and come back to the irctc. so if we are developing this in java means will it be run on the same session. but as per my knowledge bank is separate and irctc is separate URL's so it will use two different sessions then how it is maintaining same session through out application and even it uses the payment gateway? how it is working can any one help me on that??

0 Answers  


What is empty tag?

0 Answers  


Is tomcat a java ee?

0 Answers  


What is repaint in java?

0 Answers  


How to achieve multiple inheretence in java.I need an example. how we achieve.

2 Answers  


What are the most important topics in java?

0 Answers  


What is build file?

0 Answers  


Categories