answersLogoWhite

0

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

14y ago

What else can I help you with?

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.


Life cycle for a przewalski horse?

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


What is the 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 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.


How do you explain the model of destination life cycle?

explain the destination life cycle explain the destination life cycle


What is life cycle model?

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


How many interfaces in a java servlet package?

The javax.servlet package defines 12 interfaces, 7 classes, and 2 exceptions. The Interfaces are as follows:• Filter:- Preprocessor of the request before it reaches a servlet. It can also be a postprocessor of the response leaving a servlet. It can modify a request or response (for example, change headers), the request to a resource (a servlet or static content), or the response from a resource.• RequestDispatcher:- This is the servlet version of a redirect. It enables requests to be processed and then forwarded to other components of a Web application, such as another servlet, HTML file, or JSP file.• Servlet:- Defines the life-cycle methods that are implemented by all servlets.• ServletConfig:- This class has the methods for accessing the servlet configuration information such as the servlets name (from the web.xml file), the initialization parameters, and the ServletContext object.• ServletContext:- These methods enable your servlet to communicate with its servlet container. This is how you get the MIME type of a file, dispatch requests, or write to a log file. Notice that this information has application scope. The most important features of the ServletContext are application-scope attributes access, logging, and context initialization parameters.• ServletContextAttributeListener:- Implementations of this interface receive notifications of changes to the attribute list on the servlet context of a Web application. Supports the handling of the ServletContextAttributeEvent class.• ServletContextListener:- An interface that supports the handling of the ServletContextEvent class. Defines a set of methods that a servlet uses to communicate with its servlet container. It can get the MIME type of a file, dispatch requests, or write to a log file. Notice that there is one context per "Web application" per Java Virtual Machine. The specification defines a "Web application" as a collection of servlets and content installed under a specific subset of the server's URL namespace, such as /catalog, and possibly installed via a .war file.• ServletRequest:- This interface forms the base for the class that provides client request information to a servlet. It is protocol-independent.• ServletResponse:- This interface forms the base for the class that represents the response sent from the servlet to the client.• SingleThreadModel:- An interface that ensures a given servlet handles only one request at a time.