File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Scheduled Task in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Scheduled Task in Struts" Watch "Scheduled Task in Struts" New topic
Author

Scheduled Task in Struts

Anna Santiago
Greenhorn

Joined: Jul 31, 2009
Posts: 11
Hi! I'm new to struts 1 and I was just wondering if scheduled tasks can be created using the framework?

I've tried the Timer and TimerTask classes to do the scheduling and created an instance of it in my PlugIn file(class file which implements the struts Plugin) but still it only do the task once..

Any help would be appreciated. thanks thanks
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Struts is a web framework. If you want to do any scheduled tasks, use something like Quartz or Java TimerTask.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Anna Santiago
Greenhorn

Joined: Jul 31, 2009
Posts: 11
Hi Freddy,

Actually I already used the TimerTask paired with the Timer... but the task is only executed once.

You see what I'm currently implementing now is caching some data from the database by using the PlugIn of struts... but I also need to update the cached data every 2 hours for example..
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Sorry, I didn't read your question carefully. My bad.


Actually I already used the TimerTask paired with the Timer... but the task is only executed once.

That's weird. If you call Timer.scheduleAtFixedRate(), the last argument has period where you can set the task to run repeatedly.

Can you provide your code how you do that?
Anna Santiago
Greenhorn

Joined: Jul 31, 2009
Posts: 11
Actually I used Timer.schedule(new TimerTask(){...}, 6000)... but I already used Quartz and its working now...

but I think Quartz is too heavy for what I'm doing now. thank you for replying
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scheduled Task in Struts
 
Similar Threads
regarding batch file
JAR file runs when double-clicked, but not via Task Scheduler?
Creating a WAR in Eclipse
Undeploying web application does not stop the running process
Struts Plugin for Eclipse