Infolinks In Text Ads

Oct 19, 2010

About Java Servlet Life Cycle

Servlet Life Cycle:-
    There are three methods which describe the Servlet Life Cycle.
  
init() Method:- When servlet class is instantiate, servlet container called ths init() method.
The init() method is being called before receiving any request by servlet container.
     init() method takes ServletConfig object as a parameter and throw exception ServletException. Signatute of this method is
    public void init(ServletConfig config) throws ServletException.

service() Method:- When servlet is instantiate properly. Servlet container called the service() method. This method handle the client request and give the response back to the client.
    service() method takes two parameter named ServletRequest and ServletResponse and throw ServletException and IOException. Signatute of this method is
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
  
destroy() method:- when your web application server is shuting down, Servlet container called the destroy() method. When destroy() method is called. It release all thread which is run under the service method.
    Signature of destroy() method is
    public void destroy()

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...