Servlet Interface


Servlet Interface, When the Servlet is deployed in the server the Servlet container creates life cycle of the Servlet. The central abstraction in the Servlet API is the Servlet interface, all the Servlets have to implement this interface either directly or by extending a class such as GenericServlet, HttpServlet. Following are the different methods of servlet interface.

public void init(ServletConfig config)initializes the servlet. It is the life cycle method of servlet and invoked by the web container only once.
public void service(ServletRequest request,ServletResponse response)provides response for the incoming request. It is invoked at each request by the web container.
public void destroy()is invoked only once and indicates that servlet is being destroyed.
public ServletConfig getServletConfig()returns the object of ServletConfig.
public String getServletInfo()returns information about servlet such as writer, copyright, version etc.
Servlet Interface
20%off for Ink 280 281

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More