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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global variables

Status
Not open for further replies.

sparc20

Programmer
Mar 13, 2002
56
GB
Assume:

I have a servlet with overriden init() function
and doPOST() doGET() implemented as normally.

I declare some global integer variables x,y which
are initialised to 0 (int x=0,y=0;) (this is
positioned outisde the init method)

is this line called only when the servlet starts
or whenever the servlet is called(with doPOST/doGET ) ?
 
init() is only called when the servlet is initialised.

Similarly destroy() is only called when the servlet container closes down (or reloads the whole webapp).
 
that doesn't answer my question, but i found out anyway, thanx
 
Well, in that case I put it to you that you did not ask your question clearly enough.

You started your question talking about the init() method, and ask when this method is called. Seeing as you don't even mention where your variables are declared or accessed, I assumed that your question was regarding the init() method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top