Scheduling Jobs in a Java Web Application
Added 31 Jul 2008
There is a robust open source solution that works
like a charm to standardize the way you conduct scheduling in a web
application (or any other Java application, for that matter). The
following examples will show you how to use Quartz, an open source
scheduling library, to create a scheduling framework in your web
application. The example also uses Struts Action framework plugins in
order to initialize the scheduling mechanism when the web application
starts. The Struts Action framework (or just "Struts") is a such a
common framework that it should be familiar for most developers. Of
course, there are many other frameworks available for Java web
applications that facilitate a Model-View-Controller design pattern.
The first thing we want to do is set up the Struts plugin to create our scheduler when the container starts. For these examples, it is assumed that Tomcat will be the web application container of choice, but the examples should work in any container. We will create a Struts plugin class and add some lines to the struts-config.xml file to get this going.
The first thing we want to do is set up the Struts plugin to create our scheduler when the container starts. For these examples, it is assumed that Tomcat will be the web application container of choice, but the examples should work in any container. We will create a Struts plugin class and add some lines to the struts-config.xml file to get this going.