Another option is to just make a service request from the command line (or
anywhere else): it's still HTTP, it's just not coming from a browser.
Depending on what you need to get back this can be quite convenient.

Dave

On Tue, Aug 17, 2010 at 3:45 PM, Cimballi <cimba...@cimballi.net> wrote:

> Struts allows its actions to be tested using unit testing with mock
> requests and responses, so yes, you can call the actions from a
> command line tool.
>
> You can follow the guide here about unit testing Struts actions :
>
> http://cimballisblog.blogspot.com/2009/09/unit-testing-struts2-actions-with.html
>
> Cimballi
>
>
> On Tue, Aug 17, 2010 at 2:40 PM, E2241 <amu...@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.-tp29449292p29449292.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
>
>
>
> --
> Cimballi
> Freelance - JAVA J2EE project leader
> http://cimballi.elance.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to