I observed following behaviour in Tomcat server. Declare a simple Java class as a servlet using <servlet-name> and <servlet-class> tags of web.xml and then give value given in <servlet-name> tag as a value of <load-on-startup> tag. surprise..when server starts this class is getting Instantiated. Here is my question..What's the purpose of <load-on-startup> tag in web.xml? I understand that is to load servlets when webcontainer started. Secondly will container allow a simple class that is not extending servlet class to be declared as a servlet class? What is correct functionality according to standards? And if I want to start some simple Java class as a startup what is standard way of doing this? Expecting feedback. Cheers Manohar
The <load-on-startup> sub-element indicates the order in which each servlet has to be loaded. Lower positive values are loaded first. If the value is negative or unspecified, then the container can load the servlet at anytime during startup. And about your first question, it make no sense to declare a "non servlet" class as a servlet because it is unable to accept request, so you don't need the webcontainer to map it. [ October 04, 2002: Message edited by: Juanjo Bazan ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: What's the purpose of load-on-startup tag in web.xml?