| Author |
How to test load-on-startup in Eclipse
|
yusuf Kaplan
Ranch Hand
Joined: Mar 11, 2011
Posts: 56
|
|
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: 4349
|
|
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: 56
|
|
|
Thanks for the answer which solved my problem.
|
 |
 |
|
|
subject: How to test load-on-startup in Eclipse
|
|
|