This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet init Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet init" Watch "Servlet init" New topic
Author

Servlet init

Mortin kim
Ranch Hand

Joined: Nov 15, 2007
Posts: 44
HI.,
i have one application with 100 servelts.all contains inti() method implemented,so when i deployed the application in server,all the inti methods inside 100 servlets will get called..?or when i sent request to that particular servlet then only init method will get called..?

Thanks
Kim.
Sundar Ram
Ranch Hand

Joined: May 22, 2006
Posts: 102
>,all the inti methods inside 100 servlets will get called..?or when i sent >request to that particular servlet then only init method will get called..?


By default each servlet gets initiated only when that servlet is requested. You may change this behavior by using <load-on-startup> element which will initialize your servlet when the application is deployed.


SCJP 5.0 | SCWCD 1.4
http://heysundar.blogspot.com
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Sundar means when the servlet is first requested. So init is not called for any other requests besides the first one.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
jQuery in Action, 2nd edition
 
subject: Servlet init
 
Similar Threads
Mechanism of init method to initialize servlet
Servlet init method
init() vs constructor
when init() method is called ?
who calls service method ?