aspose file tools*
The moose likes Struts and the fly likes does struts provide a init() method like servlet does Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "does struts provide a init() method like servlet does" Watch "does struts provide a init() method like servlet does" New topic
Author

does struts provide a init() method like servlet does

Yuhong Qian
Greenhorn

Joined: Jan 18, 2010
Posts: 5
Hi all,

I am transfering my web application from servlet to struts1.2. In one of my servlet init() method I created a thread to do some work on the background, and I need to keep the same thing in struts appliaction. How can I do this? does struts provide a init() method like servlet does.


Thanks

Yhqian99


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why are you moving from servlets to a nearly-as-old technology? Doesn't seem like a good idea to me.

In any case, if you need to start a thread on application startup, it'd be better to use an application context listener, or maybe a Struts plugin--but I'd try to decouple it from Struts, particularly Struts 1, as much as possible. No real reason to move that out of default app container stuff.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: does struts provide a init() method like servlet does