I want to execute a jsp code automatically whenever the server is started. I tried with implementing the jsp file as a jar file and deployed in tomcat server but it doesn't start that program to run. Do i get any help regarding this. Thanks in advance.
No, jsp doesn't take it to any other page . It will just execute some set of instructions in the code. Making you clear about the concept, In a case some set of things to be executed automatically at the time of deployment in server ( in other words When server is started this set of codes will be executed at back end) It doesn't take it to any page. I had made this jsp codes as a jar file and implemented in the library but when deployed in server this code doesn't affect.
Tim Moores wrote: load-at-startup servlets, too, should not be used.
Tim, Please can you explain me why we should not use load-on-startup?
Joined: Sep 21, 2011
Let me clarify: load-at-startup servlets should not be used for initialization. if their purpose is to warm up a servlet before use, that's fine, although few servlets should have such noticeable init work that it can't be suffered by even just the very first request.
But historically, load-at-startup servlets originate from a time when there were no context listeners, and they were used for init work - it's a hack to use an HTTP processor if there is no HTTP request, servlets just like JSPs.