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

How to create war file?

844


What are session variable in servlets?

802


What is servletconfig?

788


Difference between forward() method and sendredirect() method ?

818


How do you run a servlet?

813


Can we get PrintWriter and ServletOutputStream both in a servlet?

934


Whats the advantages using servlets over using CGI?

838


What are the differences between the servletconfig interface and the servletcontext interface?

882


What do you mean by filter in servlet?

774


How do you load an image in a Servlet?

906


What do you mean by scope object and what are its types?

822


What are the different ways we can maintain state between requests?

812


What is the use of send redirect () method?

824


What do you mean by default initialization in java servlet?

904


What are different methods of session management in servlets?

1037