You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by E2241 <am...@yahoo.com> on 2010/08/17 21:42:51 UTC

Calling Struts Action file through command line.

Hi,

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 (if needed for any business logic)
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 the bean. But what happens 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? Can we call the action class in this manner by
instantiating it and calling execute(). 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

-- 
View this message in context: http://old.nabble.com/Calling-Struts-Action-file-through-command-line.-tp29449293p29449293.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

Re: Calling Struts Action file through command line.

Posted by Paul Benedict <pb...@apache.org>.
If you want to create mocks for your JEE objects, perhaps it's possible.

On Tue, Aug 17, 2010 at 2:42 PM, E2241 <am...@yahoo.com> wrote:

>
> Hi,
>
> 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 (if needed for any business logic)
> 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 the bean. But what happens 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? Can we call the action class in this manner by
> instantiating it and calling execute(). 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
>
> --
> View this message in context:
> http://old.nabble.com/Calling-Struts-Action-file-through-command-line.-tp29449293p29449293.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>