Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlets

 
jasvinder Pal singh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in how many different ways a init() method can get executed.?
 
olivier dutranoit
Ranch Hand
Posts: 81
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way...

"Servlet init methods allows a servlet to perform one-time initialization prior to servicing requests."

"When a server loads a servlet, it runs the servlet's init method. Once."
 
Tim Moores
Bartender
Posts: 2802
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What prompted the question? It doesn't seem to make much sense.
 
jasvinder Pal singh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks

what i meant is..
there are two ways
1) first when the servlet get deployed in a web server container for the first time
2) when the client call the first request.

i was wondering is there any 3 way of doing it.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, there is only one way - your 2 is the same as your 1. The container will call init after the servlet instance is created and before the first request is processed, no matter what sequence of events caused the creation.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic