Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

action objects

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are action objects of struts model or controller.
 
Jesse Beaumont
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess that depends to a certain extent on what you do in your actions. I guess they could be considered either. If you use them to simply invoke a session facade in your distributed application, I would consider them part of the controller.
Whereas if you start maniuplating your object model and accessing the RDBMS you could say that the action is part of the model.
It is probably cleaner to consider them part of the controller and implement the business logic elsewhere where reuse is more likely.
Jesse
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pradeep,
the Struts Actions form definitively the Controller part. It is technically possible to add Model logic in the Action. But as Jesse mentioned, it is advaisable to avoid to do so!
Regards
Berny Woehrlin
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to have your Actions work as part of the model, but that is considered poor design. Struts is a model neutral framework and the Actions are supposed to be extensions of the controller.
 
Ted Husted
Author
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I consider everything in the Action package (and Config package in 1.1) to be part of the control layer, including the ActionForms.
The Action is designed to provide a bridge between the presentation layer (JSPs, templates, XMLs) and the model layer. The idea is that the view layer can talk to the Action and the Action then talks to the model layer.
Ideally, the Action should be talking to a facade that condenses what it needs to know about the model layer. For example, anything involving JDBC should be behind a facade. The Action passes the required inputs to the facade, and then relays the output to the view.
HTH, Ted.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic