java - servlet life cycle while loadOnStartup -
java - servlet life cycle while loadOnStartup -
when mention servlet loadonstartup
in web.xml init
method called sure. wanted confirm service
, destroy
methods called or not? if not when called?
another question mentioned every init
method called once. mean when servlet gets request first time, init
method called , service
called.
but destroy not called. when sec request phone call service method 1 time again not init method. understanding correct? when container decides phone call destroy method?
loadonstartup
means servlet loaded (and init(..)
method called during container startup. otherwise, suspect, loaded when first request comes containers have 1 instance of each servlet. when create it, phone call init(..)
. when context undeployed (for illustration - container stopped), destroy()
called
java servlets
Comments
Post a Comment