answersLogoWhite

0

Servlet life cycle

Updated: 9/13/2023
User Avatar

Wiki User

13y ago

Best Answer

The javax.servlet.Servlet interface defines the three methods known as life-cycle method.

public void init(ServletConfig config) throws ServletException

public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException

public void destroy()

First the servlet is constructed, then initialized wih the init() method.

Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet.

There are two more methods.....

public abstract String getServletInfo()

public abstract ServletConfig getServletConfig()

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Servlet life cycle
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you proove servlets are faster than JSP?

because JSP internally changes in servlet and then follow servlet life cycle, so it is slower than servlet


Describe the life cycle of servelet?

Each servlet has the same life cycle: * A server loads and initializes the servlet * The servlet handles zero or more client requests * The server removes the servlet (some servers do this step only when they shut down) == When a server loads a servlet, the server runs the servlet's init method. Initialization completes before client requests are handled and before the servlet is destroyed. Even though most servlets are run in multi-threaded servers, servlets have no concurrency issues during servlet initialization. The server calls the init method once, when the server loads the servlet, and will not call the init method again unless the server is reloading the servlet. The server can not reload a servlet until after the server has destroyed the servlet by calling the destroy method. == After initialization, the servlet is able to handle client requests. This part of the servlet life cycle was handled in the previous lesson. == Servlets run until the server are destroys them, for example, at the request of a system administrator. When a server destroys a servlet, the server runs the servlet's destroy method. The method is run once; the server will not run that servlet again until after the server reloads and reinitializes the servlet. When the destroy method runs, another thread might be running a service request. The Handling Service Threads at Servlet Termination lesson shows you how to provide a clean shutdown when there could be long-running threads still running service requests.


What is a life cycle to a white wolf?

it is a life cycle to them or their life.


Does a moth have 3 - stage life cycle or 4 - stage life cycle?

A moth has a 4-stage life cycle.


Life cycle for a przewalski horse?

the life cycle for horses are for all breeds. it is a dumb life cycle


What is life cycle of a plum?

what is a plums life cycle


Where is the cougar in the life cycle?

cougars life cycle === ===


What is the life cycle of a weta?

what is the wetas life cycle


What is the life cycle of a plum?

what is a plums life cycle


Picture of a life cycle of a mango?

The role of the fruit in a plant's life cycle is reproduction , in some plants it signals the end of the cycle.


What is life cycle model?

Software life cycle model is a descriptive and digramatic representation of the software life cycle.


How do you explain the model of destination life cycle?

explain the destination life cycle explain the destination life cycle