GeeCON Prague 2014*
The moose likes Servlets and the fly likes servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets" Watch "servlets" New topic
Author

servlets

jasvinder Pal singh
Greenhorn

Joined: Oct 04, 2011
Posts: 6
in how many different ways a init() method can get executed.?
olivier dutranoit
Ranch Hand

Joined: Aug 20, 2011
Posts: 81

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
Rancher

Joined: Sep 21, 2011
Posts: 2408
What prompted the question? It doesn't seem to make much sense.
jasvinder Pal singh
Greenhorn

Joined: Oct 04, 2011
Posts: 6
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

Joined: Mar 22, 2000
Posts: 12792
    
    5
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
 
GeeCON Prague 2014
 
subject: servlets