Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call to INIT() method in a life cycle of servlet

Status
Not open for further replies.

varavoorvishnu

Programmer
Sep 9, 2002
45
Hi All,
The below are the 3 stages when the init() is called in a life cycle of a servlet.The below definitions are provided from Servlet programming by O'relly.

1.when the server starts
2.when the first request to the servlet,called before invoking the service() method.
3.Request from the service Administrator.

Now 1 and 2 looks contradictory.

2nd statment is executed only when a server starts.
As we know that if the server is started only,one can send a requesst.
But as per the 1st statement,then init method will be called and then also for the first request.The theory goes wrong here.
I knew tht init() is called once..but everything looks wrong with the above statements..
I couldnot get the concept right!!
Hope every1 got my understanding..

Plz clarify.
Regards,
Vishnu
 
Should be :

1. When the server starts - IF the web.xml <servlet> tag has a <load-on-startup> value.
2. When the first request comes, IF the init() method was not called previously on startup.

HTH

 
I tried the first option u said to me (i.e.) by adding a new tag in web.xml <servlet><load-on-startup....
still it didnot work..
Can u give some more explanation plz.

Regards,
Vishnu
 
Like this :

<servlet>
<servlet-name>PoolControllerServlet</servlet-name>
<servlet-class>pool.servlet.PoolControllerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
 
I gave the similar tags and gave the correct path of the servlet..still it throws the parsing error...

vishnu
 
A parsing error ? Can you post it ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top