permaculture playing cards
The moose likes Struts and the fly likes Calling Struts Action file through command line. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Calling Struts Action file through command line." Watch "Calling Struts Action file through command line." New topic

Calling Struts Action file through command line.

Aman Mohd

Joined: Feb 26, 2009
Posts: 13
Hi Friends,

1.) I would like to know if it is possible to call the struts framework through a command line or a console application. Can one call an action class? Is there any possibility to do so? I think its not possible as everything would depend on the struts-config file and the Http Request object. From the config file the request would probably know which action class to invoke and the respective bean would be called.

2.) I have a web application which is based on the struts framework. I know for a fact that only once the request is submitted the struts-config would map the action and beans. But in a case where there would be no Http Servlet Request object, instead it would be a call from a console application trying to invoke an action class to perform the business logic; is that possible?

3.) What if i create a HttpServletRequest object in the console app and then call the action class? Then I would probably have to call the bean in the action class itself beating the MVC pattern framework and the use of the config file. Not sure if we can invoke the config file from command line.

Please give your thoughts on this. I am not sure if I have been clear enough in explaining this. My main requirement is to try and see if i can call and execute the business logic implemented on the struts framework (in action and bean) through a console application.

David Newton

Joined: Sep 29, 2008
Posts: 12617

Please BeForthrightWhenCrossPostingToOtherSites (in this case the Struts user mailing list).
I agree. Here's the link:
subject: Calling Struts Action file through command line.
It's not a secret anymore!