aspose file tools*
The moose likes Servlets and the fly likes when the init() method will be callled Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "when the init() method will be callled" Watch "when the init() method will be callled" New topic

when the init() method will be callled

chandra kunchala

Joined: Aug 06, 2008
Posts: 17
can you tell me when the init() method will be called.

Thanks & Regards
Chandra SCJP5.0
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39547
The javadocs of Servlet.init(ServletConfig) and GenericServlet.init() combined together answer this question.

Note that a servlet may placed into service either at startup of the web app, or when the first request for that servlet comes in.

Ping & DNS - updated with new look and Ping home screen widget
Rohith Kumar Singh

Joined: Aug 27, 2008
Posts: 6
init() method of a Servlet is called by the Servlet Container at the time of initializing the servlet. There are two types of initialization possible: pre-initialization (which is done using load-on-startup element of web.xml) and lazy initialization (on demand).

[ August 27, 2008: Message edited by: Bear Bibeault ]
I agree. Here's the link:
subject: when the init() method will be callled
Similar Threads
suggestions for a "user selectable database" design
exception handling
Mechanism of init method to initialize servlet
Why is init() needed?
How to find if the servlet is newly created or it was already existing