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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does j2ee stand for?

678


What is javabeans component?

716


What is java 2 platform, enterprise edition (j2ee)?

686


What are the topics in j2ee?

725


What is setbounds in java?

731


Why java is oop language?

727


What is advance java?

688


What is the concept of connection pooling?

759


how to run servlet program between two computer through internet ?

2739


Why is java called object oriented?

696


What is a thin client?

749


Is eclipse written in java?

729


What is deployer?

743


What is build tool in java?

699


What is devops in java?

740