• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet init

 
Mortin kim
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>,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.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sundar means when the servlet is first requested. So init is not called for any other requests besides the first one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic