• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

action class in struts 1.2

 
priyanaka jaiswal
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


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


Thanks in advance
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Priyanka,

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

I agree with suresh explanation.
 
asr chowdary
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks Vineela..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic