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

Explain servlet life cycle?

614


How to get the path of servlet in the server?

534


What is the use of send redirect () method?

588


What is meant by Servlet? What are the parameters of service method?

594


How can we include static files in the jsp page?

611






If some new data has entered the database, explain how can a servlet refresh automatically?

735


How do you define a servlet?

523


Difference between java beans & servlets?

588


What do you mean by filter in servlet?

535


Define the lifecycle for executing a jsp page.

591


What is the directory structure of a war file?

709


Which exception is thrown if the servlet is not initialized properly?

588


What's the advantages using servlets than using cgi?

556


how the HTML data stored in web server?

1952


If servlet receives multiple requests, how many objects will it create?

827