In your web.xml file, declare a servlet like this :
<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>xx.xx.xx.myServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
And in your servlet, the init() method is called when the server start :
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class myServletextends HttpServlet
{
/** Init */
public void init(ServletConfig config) throws ServletException
{
super.init(config);
// do your action
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
// ...
}
}
Antony
>>> [EMAIL PROTECTED] 07/10/2005 18:32:03 >>>
Hi!
I'm writing a web application for tomcat and I have a strange request:
I would like to execute an initializing function in order to
initialize correctly my applicaiton when it becomes available
(deployed into tomcat or tomcat itself is started)
I have written such behaviour in a method, so what can I do to execute it?
Thanks for your help, Matteo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]