what is the control flow in servlet when we send a request?

Answer Posted / dipak.cvrca

-->first request comes from client browser to server
(container)which takes the control to the web.xml file.

-->in xml file servlet file(.class) will be searched
according to the information about the url pattern given
in the address,then coresponding class file is loaded to
the container(loading) by the method
java.lang.class.forName().newInstance.

-->now container call the init(servletConfig) method to add
necessary headers in the servlet,such as Config,context
session,request and many more.

-->now control pass to the service()of the HttpServlet(if
you have extended this class) and the type of method
(get/post) is checked and accordingly the control will
pass to the implemented doGet() or doPost() of the your
class(by the dynamic method dispatch)

-->after service the container will call the destroy() of
Servlet class.
i hope this answer will satishfy you,thank
you,(Dipak ku. jenamani)

Is This Answer Correct ?    95 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the differences between jsp and servlet.

738


What is the type of method for sending request from http server?

809


What is cgi and what are its drawbacks?

762


What is the use of java servlet api?

798


What are the different session tracking techniques?

964


Why is httpservlet declared abstract?

803


Where do you define dispatcherservlet?

755


How will two or three servlets interact or communicate with each other?

1163


Why is init() method is used in servlets?

747


What do you mean by request dispatcher in servlet? Also explain its methods.

859


Which HTTP method is non-idempotent?

821


What is the difference between get and post methods?

792


Explain request dispatcher and its methods.

785


Elucidate servlet attributes and its scope?

766


Can filter be used as request or response?

740