It's not a secret anymore!*
The moose likes Struts and the fly likes action class in struts 1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "action class in struts 1.2" Watch "action class in struts 1.2" New topic
Author

action class in struts 1.2

priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79
Hi,


Is Action class is part of controller or model?i am confused


Thanks in advance
Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Hi,

In my way to see the world I would say that an action is part of the controller,
a form is part of the view model and a dao is part of the data model.


Best regards,,
Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Carles Gasques wrote:Hi,

In my way to see the world I would say that an action is part of the controller (because links presentation with business logic),
a form is part of the view model and a dao is part of the data model.


Best regards,,
hari gutta
Ranch Hand

Joined: Mar 03, 2013
Posts: 33

Action class is a part of Controller.

The first thing that makes me confirm this is, "Struts handle with Controller and Views only, but not with Models(EJBs/COBRA/whatever should handle model) in Struts MVC framework".

It tries to do the communication before business logic, and ActionForm is a view data Transfer Object - that merely transfers the data to various classes within the controller.
asr chowdary
Ranch Hand

Joined: Mar 14, 2013
Posts: 35
Hi

Action class can act as a model and also helper class for controller servlet called ActionServlet in struts

MVC rule Controller(ActionServlet) should interact with model

1.Action class as a Model
In small scale applications,It is good to write Business Logic in Action class.ActionServlet interacts with Action class.

2.Action Class as a helper Class for Contoller Servlet(ActionServlet)(part of controller)

In Large scale applications where Spring or EJB componets are acting as a model,There Cortoller Servelet(ActionServlet) can not interact with Spring or EJB components because its a Built_in class ,so we write the logic to interact with Spring or EJB in Action class.That means ActionSevlet interaction with the Model with the help of Action class.

Thanks
keerthi vineela
Greenhorn

Joined: May 10, 2013
Posts: 24
Hi Priyanka,

Action class acts as both Controller and Model depends on the application.

I agree with suresh explanation.
asr chowdary
Ranch Hand

Joined: Mar 14, 2013
Posts: 35

Thanks Vineela..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: action class in struts 1.2
 
Similar Threads
Struts - Error creating form bean
Can't Return action error from action class
Struts Action class and Action Form
help! ClassNotFoundException thrown in struts?
Class Diagram question