Question

I have a JSP file starts a TimerTask on the server. Everytime that the server is restarted, The TimerTask object is lost and I have to manually hit the JSP page to set it again. By any chance, can I add a server script that hits the JSP page automatically just after the server has been restarted?

Note: Its a JBOSS 3.2.8 server

Était-ce utile?

La solution

Pull the code from JSP, place it in a servlet and define a servlet to be initiated automatically in web.xml.

<servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>com.class.MyServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

(Servlet can forward to the same JSP so that requests could still get that JSP)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top