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

Which interface must be implemented by all servlets?

789


Given the request path below, which are context path, servlet path and path info?

541


What do you mean by singlethreadmodel interface?

578


What do you mean by chaining in servlet?

566


What is getservletcontext?

546






What is called servlet container?

658


What is servlet container. how it works?

607


Explain the war file?

606


request parameter how to find whether a parameter exists in the request object?

566


What are all the protocols supported by httpservlet?

646


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

604


How to handle exceptions thrown by application with another servlet?

608


What is difference between ServletResponse sendRedirect() and RequestDispatcher forward() method?

614


How do you deal property files in servlet?

598


What is the use of request dispatcher interface?

565