This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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
Author

when the init() method will be callled

chandra kunchala
Greenhorn

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


Thanks & Regards
Chandra SCJP5.0
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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 - my free Android networking tools app
Rohith Kumar Singh
Greenhorn

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).

Cheers,
Rohit
[ August 27, 2008: Message edited by: Bear Bibeault ]
 
GeeCON Prague 2014
 
subject: when the init() method will be callled