Question :
Servlet class is loaded
Ans : The classloader is responsible to load the
servlet class. The servlet class is loaded when the first request for the
servlet is received by the web container.
Question : Servlet instance is created
Ans : The web container creates the instance of a
servlet after loading the servlet class. The servlet instance is created only
once in the servlet life cycle.
Question : init method is invoked
Ans : The web container calls the
init method only once after creating the servlet instance. The init method is
used to initialize the servlet. It is the life cycle method of the
javax.servlet.Servlet interface. Syntax of the init method is given below:
1. public void init(ServletConfig config) throws ServletException
Question : service method is invoked
Ans : The web container calls the service method each
time when request for the servlet is received. If servlet is not initialized,
it follows the first three steps as described above then calls the service
method. If servlet is initialized, it calls the service method. Notice that
servlet is initialized only once. The syntax of the service method of the
Servlet interface is given below:
1. public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
If this information is important to you , and you want to , I will continue writing some more details of programming language, so click on the advertising, available on this page. This is motivate me for writing some more blogs.
Comments
Post a Comment