You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by UseTheFork <jv...@gmail.com> on 2008/09/26 18:54:37 UTC

Action and ActionForm newbie questions

Hi, 

I am learning about Struts and I am trying to understand the proper usage of
Actions and ActionForms. Can you tell me if the following is correct?

i) Actions are implemented as glue between the View (JSP for example) and
the Model part (Hibernate for example) in MVC. Typically, they should not
implement business logic, but call EJBs instead.

ii) When the struts controller calls execute(...) on the Action class, an
ActionForm class may be passed as a parameter (if such has been implemented
and if struts has been configured properly).

iii) An ActionForm contains the data entered by the user on a HTML (or JSP
page) form. Some data validation can be performed.

iv) Once the Action has finished its job, it returns the next page to
display via an ActionForward object.

Thanks,

J.
-- 
View this message in context: http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19692405.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action and ActionForm newbie questions

Posted by UseTheFork <jv...@gmail.com>.
Hi Dave, 

I am sorry if this question goes out of the range. Thanks for your answer
!!!

J.

-- 
View this message in context: http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19721298.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action and ActionForm newbie questions

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 9/26/08, UseTheFork <jv...@gmail.com> wrote:
> What is the proper way?

There is no single "proper way". It depends on your environment, your application, and so on.

In general your actions should be wrappers around calls to services, no matter how they're implemented.

These questions are running pretty far afield of Struts.

> iii) Dave, I don't understand your comment, can you
> elaborate? What am I missing about Struts 2?

Struts 2 doesn't use ActionForms.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action and ActionForm newbie questions

Posted by UseTheFork <jv...@gmail.com>.
Hi Laurie and Dave, 

I am reading contradictory information from different sources on the
Internet and I am getting confused. 

i) Assuming that I am writing a JSP page to register a new user using a
form: I should implement an ActionForm to retrieve the data entered by the
user, correct? I should also implement an Action to manage such
registration, correct?

ii) I can use Hibernate to have a new user created and saved automatically
in the database. Where I am not clear is whether I should directly invoke my
user bean in the Action and let Hibernate handle persistence or whether I
should implement an EBJ and have the Action delegate the job? Some sources
indicate that I should implement EBJ to perform such tasks. What is the
proper way?

iii) Dave, I don't understand your comment, can you elaborate? What am I
missing about Struts 2?

Thanks, 

J.
-- 
View this message in context: http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19696185.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action and ActionForm newbie questions

Posted by Laurie Harper <la...@holoweb.net>.
UseTheFork wrote:
> Hi, 
> 
> I am learning about Struts and I am trying to understand the proper usage of
> Actions and ActionForms. Can you tell me if the following is correct?
> 
> i) Actions are implemented as glue between the View (JSP for example) and
> the Model part (Hibernate for example) in MVC. Typically, they should not
> implement business logic, but call EJBs instead.

Call EJBs?? An ActionForm is the data transfer object between the action 
and the view template (JSP usually). Business logic belongs in the 
action, or a service API the action interacts with. Talking to EJBs is 
firmly in the business logic domain and unrelated to ActionForms.

> ii) When the struts controller calls execute(...) on the Action class, an
> ActionForm class may be passed as a parameter (if such has been implemented
> and if struts has been configured properly).
> 
> iii) An ActionForm contains the data entered by the user on a HTML (or JSP
> page) form. Some data validation can be performed.
> 
> iv) Once the Action has finished its job, it returns the next page to
> display via an ActionForward object.

Yes.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action and ActionForm newbie questions

Posted by Dave Newton <ne...@yahoo.com>.
I thought you were learning Struts 2.

Dave

--- On Fri, 9/26/08, UseTheFork wrote:
> I am learning about Struts and I am trying to understand
> the proper usage of
> Actions and ActionForms. Can you tell me if the following
> is correct?
> 
> i) Actions are implemented as glue between the View (JSP
> for example) and
> the Model part (Hibernate for example) in MVC. Typically,
> they should not
> implement business logic, but call EJBs instead.
> 
> ii) When the struts controller calls execute(...) on the
> Action class, an
> ActionForm class may be passed as a parameter (if such has
> been implemented
> and if struts has been configured properly).
> 
> iii) An ActionForm contains the data entered by the user on
> a HTML (or JSP
> page) form. Some data validation can be performed.
> 
> iv) Once the Action has finished its job, it returns the
> next page to
> display via an ActionForward object.
> 
> Thanks,
> 
> J.
> -- 
> View this message in context:
> http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19692405.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org