This interface contains the life cycle methods for a servlet page
Following are the life cycle methods of Servlet Interface :-
1. Public void init (ServletConfig config) throw ServletException
This method is the first method to be executed in life cycle of the Servlet page. The method contains an object parameter of ServletConfig interface pack. The ServletConfig object holds information of Servlet container and other parameter objects.
2. Public void service (ServletRequest req, ServletResponse res) throws servletException, IOException
This method is executed after the init method. This method is used to retrieve data send by the client, process the data and access the machine resource and their after respond output back to the client who made the request.
This method contains two object parameters of ServletRequest and ServletResponse interface type. This method automatically instantiates this parameter object. This client data and information is retrieve through ServletResponse object. This method throws ServletException and IOException.
3. Public void destroy()
This method is called when the Servlet page is unloaded or destroyed by the servlet container.
View for more information about Servlet Servlet in Java