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

A simple question

 
Mohan Panigrahi
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The authors(Srikanth,Nitin) of 'Struts Survival Guide' state that there is no component of struts in 'model' category of MVC framework.

But I feel that Action class should belong to model category, because it would contain the business logic. Any elaboration on this?

Thanks,
 
Paul Strachan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It makes good design sense to separate your business logic from the struts layer, which is only handling http requests from a browser. What if you wanted to execute the same business logic originating from a wireless device or web service for instance?

Your action classes should call your business logic/model - possibly through a business delegate, but your business model should not depend on http.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Struts Action class is a controller component, not a model component. The primary controller object is the Struts ActionServlet, but the Action is still part of the controller space. Its function is to mediate between the model and the view. As Paul indicated, your business logic should go in separate objects that are then called by the Action.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic