Life Cycle of servlets?

Answer Posted / ravikiran(aptech mumbai)

1).container will find the web.xml
2).container parses the web.xml
3).creates the instance of servlet using
class.forname(classname).newInstance()
4).preinitializes the servlet with the entry known as
<load-on-startup>
5).Initializing the servlet instance using
init(ServletConfig config) method
6).Container creates request and resonse objects and finds
that the requested resource is a servlet and invokes a new
thread for the particular request
7).Calls doGet() or doPost() inaccordance with the method
decared inside html
8).And passes the request and response objects into the
doGet() or doPost()
9).And with the help of response object the response is ent
back to the client
10).destroy() method call will cleanup the resources
11).the thread will go into a pool
12).The request and response objects will be sent to an
output stream

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is Servlet so popular?

618


What is the use of welcome-file-list?

576


Write a program to show the functionality of doget and dopost method?

661


How forward () method is different from send redirect () method?

520


What is the difference between Difference between doGet() and doPost()?

759






What are sessions in servlets?

582


Can we get PrintWriter and ServletOutputStream both in a servlet?

663


What do you mean by httpservlet?

568


What is the use of httpservletresponsewrapper?

538


Whats the advantages using servlets over using CGI?

590


What is the purpose of inter-servlet communication?

597


When jsessionid is created?

609


What mechanisms are used by a Servlet Container to maintain session information?

672


What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?

607


What is the difference between using getSession(true) and getSession(false) methods?

576