aspose file tools*
The moose likes Struts and the fly likes How to invoke struts action through a simple java class 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 "How to invoke struts action through a simple java class" Watch "How to invoke struts action through a simple java class" New topic
Author

How to invoke struts action through a simple java class

ajch Chawla
Greenhorn

Joined: Jan 10, 2005
Posts: 7
Hi All,

I need to invoke some struts action through a simple java/servlet which is running as a seperate thread in my application.
Any solutions?

Ajay
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Forward the request/response to the Action using the same RequestDispatcher#forward(request, response) method you would use for regular servlets.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Jitesh Sinha
Ranch Hand

Joined: Jun 19, 2004
Posts: 144
If you only want to call Action class,it should not be difficult.
Just need to load that particular action class by a classloader and execute the execute/perform method depending on whatever version of struts you are using...
This is identical to what RequestProcessor class does within struts framework...
Jitesh Sinha
Ranch Hand

Joined: Jun 19, 2004
Posts: 144
Lasse,I doubt he will have access to RequestProcessor class
ajch Chawla
Greenhorn

Joined: Jan 10, 2005
Posts: 7
yeh.
thanks.
Now the problem is how do I run a servlet as a deamon thread.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by ajch Chawla:
Now the problem is how do I run a servlet as a deamon thread.

You don't. What you can do is to have your servlet start a new, separate daemon thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to invoke struts action through a simple java class
 
Similar Threads
ajax and struts action class
I m not able to print out.println on target iframe
Filters and web.xml problem + Eclipse
How to pass url to Struts1.3
pass value between two action class