Dale The init(Servletconfig conf) method is from the servlet interface, it is called by the web container and passes the config object. You can override it in your servlets but then must remebe to call super.init(ServletConfig). The init() method is provided in the GenericServlet class and is just there as a convienence to the programmer so you dont have to call super.init(ServletConfig). The init() method (if you override it) is called by the init(Servletconfig) method. You get that functionality from the GenericServlet class, so if you were trying to make our own servlet hierarchy by just implementing Servlet and ServletConfig you wouldn't get that ability - then again why would you want to do that hope that helps
Joined: Nov 02, 2000
So my question is, do you HAVE to call it? When do you feel it is appropriate to call it. Why is it provided? -Dale
Originally posted by Dale DeMott: So my question is, do you HAVE to call it? When do you feel it is appropriate to call it. Why is it provided?
The init method is called ONCE, when your servlet is first created -- you do ONE TIME setup things here (its not called for each request) -- people often use it to getInitParameters() defined for the servlet...
NO!! The only time you have to call either of the inits is when you override the init(Servletconfig) then you have to call super.init(ServletConfig). If you only have init() then you dont have to do anything - your method is called by the init(ServletConfig) that was, in turn, called by the web container.