File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to test load-on-startup in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to test load-on-startup in Eclipse" Watch "How to test load-on-startup in Eclipse" New topic
Author

How to test load-on-startup in Eclipse

yusuf Kaplan
Ranch Hand

Joined: Mar 11, 2011
Posts: 58
Hi all,

I configured a servlet with load-on-startup 1, but the Servlet is still load when it is requested. I expected it to load when the container is started.
I verified it by debugging my example app using Eclipse and Tomcat.
I tried without "load-on-startup 1" and started my form.html with "Debug on Server." The debugger went into doPost after I clicked Submit on my form. Thats fine.
But with "load-on-startup 1" I expect the debugger to go into doPost right after I "Debug on Server" the form.html.
Is my expectation correct here?

Cheers,
Y
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5208
    
  12

No, not correct.

load-on-startup defines when your servlet is loaded. The doGet and doPost methods have nothing to do with it. They are just invoked on each GET- or POST-reguest

Override the init-method and put a breakpoint on a line in this method. For example:


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
yusuf Kaplan
Ranch Hand

Joined: Mar 11, 2011
Posts: 58
Thanks for the answer which solved my problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to test load-on-startup in Eclipse