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 is core java and j2ee?

672


What is a jbutton in java?

694


How do you compile java?

677


What is deployer?

722


What is the use of method saveorupdate()?

762


What is commit?

827


What is container-managed persistence?

717


What is fatal error?

777


What is webservices in java?

675


Which of the following are subclasses of java awt component?

681


What are the j2ee technologies?

658


J2ee is a container centric architecture. Explain.

682


What is application configuration resource file?

691


Define authorization constraint?

759


What is entity reference?

706