This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes load-on-startup doubt ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "load-on-startup doubt ..." Watch "load-on-startup doubt ..." New topic
Author

load-on-startup doubt ...

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

When i use the <load-on-startup> tag in the DD, the Servlet is loaded at deploy time, this is ok with me. But, does the <load-on-startup> call the init method on that Servlet ?

Please clear my doubts ...

Thanks in advance ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
You might like to try something like a servlet with code such as


public void init(){
ServletContext ctx = getServletContext();
ctx.log("initializing");
}

Then restart your container without requesting the servlet and see what is in the the log.

Marcus


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Yes,

Loading also initializes. It will take you to the point where in when your first request comes in, it starts with the service method.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Thank you
 
Consider Paul's rocket mass heater.
 
subject: load-on-startup doubt ...
 
Similar Threads
load-on-startup of servlet tag in DD
Can i run a servlet on tomcat startup?
Deploy struts app
Static Initialization Block
servlet start up on server initialization