users@glassfish.java.net

Init() method of a Httpservlet is called everytime -- Glassfish 3.1.1

From: <forums_at_java.net>
Date: Fri, 13 Jan 2012 11:17:55 -0600 (CST)

 I have a servlet which extends HttpServlet

it has the following 2 methods:

 

 @Override

 

public void init() throws ServletException
 

 

{

System.out.println("init");

}

@Override

public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException

{

System.out.println("doGet");

}

 

When I use browser to access this servlet, the init() mothod is called on
every request. Shouldn't it be called only once in a life time?


--
[Message sent by forum member 'wlin']
View Post: http://forums.java.net/node/882697