Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

load on startup  RSS feed

 
Thomas Greene
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set the load-on-startup element in my web.xml to 1 but still the init() method is called only when the client makes the first request.
Here is my servlet




and here is my web.xml file



I was expecting to see "HELLO" printed on restarting the server. But it doesn't come up until a request is made.
Am I interpreting it incorrectly?
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put your <load-on-startup> inside the <servlet> you want to load.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!