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

Whether we can get deadlock situation in servlets?

572


How the JSP file will be executed on the Server side?

640


What are the objects involved when a servlet receives a call from client?

545


What’s the difference between sendredirect and forward methods

561


What are the disadvantages of storing session state in cookies?

625






What is the workflow of a servlet?

715


How do you create a cookie using servlet?

575


How do I know if java is running on linux?

601


What is servlet container?

661


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

582


What is servlet attributes and their scope?

594


What are different ways for servlet authentication?

559


How do you define a servlet?

521


What is the use of httpservletrequestwrapper?

584


How do you communicate in between Applets and Servlets?

587