This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Question concerning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Question concerning "Action" classes (Chapter 3 of Struts 2 Design and Programming)" Watch "Question concerning "Action" classes (Chapter 3 of Struts 2 Design and Programming)" New topic
Author

Question concerning "Action" classes (Chapter 3 of Struts 2 Design and Programming)

Frederic Thierry
Greenhorn

Joined: Apr 16, 2006
Posts: 22
Hello Budi,

I recently was able to browse through your first few chapters available on the brainy software website and I was wondering whether you could answer the following question:

I had a look at your 3rd chapter and you described Action classes as being the model classes in Struts2(Hence this class will contain the business logic). But recently I came accross a website that described Actions rather as Controllers. So I am now confused. Could you please tell me whether Action classes act as the "Model" or the "Controller".

What about when I use Struts 2 with a Spring Business Facade, do Actions then change role from "Model" to "Controller"?

Thank you very much in advance for claryfiyng this topic for me.

Thanks,

Fred
Budi Kurniawan
Author
Ranch Hand

Joined: Apr 30, 2002
Posts: 65
I've heard people describing the action as part of the Controller. My guess is they view the action as a place where models are instantiated and business methods/delegates called. In this case, it is not inaccurate to regard the action as an extension of the controller.

On the other hand, in Struts 2 an action is often a POJO with properties that get assigned values and have methods that do more than validation. In this case, clearly it is a model.
 
Consider Paul's rocket mass heater.
 
subject: Question concerning "Action" classes (Chapter 3 of Struts 2 Design and Programming)