Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to test load-on-startup in Eclipse

 
yusuf Kaplan
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9933
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
yusuf Kaplan
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer which solved my problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic