adspace


What is the life cycle of Servlet?

Answer Posted / shaik baji

Servlet life cycle contains the following steps in it:

step 1: When the first request comes to the servlet, the
container will load the servlet if and only if the user is
not specified <load-on-startup> tag in web.xml

step 2: The container will instantiates the servlet

step 3: The container will invoke the init() method of the
servlet with the ServletConfig as a parameter

step 4: The container will create the thread for that
request and invokes the service() method

step 5: Once the service method execution is completed the
container will invoke the destroy() method to release the
Servlet object.

Step 6: The servlet will unloaded from container when the
web server or the web application is getting shutdown.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is minecraft 1.15 out?

1043


What is the difference between break and continue statements?

1121


How to create a base64 decoder in java8?

1133


How to sort array in descending order in java?

990


explain different ways of using thread? : Java thread

1079


What is a constructor overloading in java?

1123


Explain public static void main(string args[]) in java.

1069


Realized?

2259


Write a program to print count of empty strings in java 8?

1084


What is a classloader in java?

1086


What is the difference between equals() and == in java?

1035


What is java string pool?

1079


Differentiate between static and non-static methods in java.

1123


What do you mean by an interface in java?

1098


What is parsing in java?

1036