This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In a Model/View/Controller framework such as Struts, an Action class is the main controller class that you write. The job of a controller class is to act as a mediator between the Model and the view. If you're using EJBs for your Model, it makes sense that the Action class becomes the client for your EJBs. It then sends information to the view based on what it retrieves from the EJB layer. An ActionForm is a class that is more tightly-coupled with the view, and therefore is not a good place to interact with a model-layer object such as an EJB.
I glanced at the article, and there is a lot of good information there. I'm happy to clarify, but you'll have to tell me specifically what it is you find confusing about the article.
Joined: Feb 15, 2005
Ok, now I see what you mean. The article has a diagram showing a line between the business logic and the the form bean.
All I can say is that I don't agree with the diagram. If I had drawn it, the line would be between the Action class and the business logic. While the ActionForm will certainly contain data sent from the model, it is the Action class that should control the interaction and then populate the ActionForm. It should not be populated directly from the model layer.
For one thing, if you did this, you would introduce a dependency on Struts into your Model layer, which is not desirable.
Joined: Mar 19, 2007
Thanks for the clarification
Joined: Feb 15, 2005
However, before posting again, there's something I'd like you to take care of. Since "ram data" is an obviously fictitious name, it is in violation of our naming policy, which we take quite seriously. Please change the "publicly displayed name" in youruser profile so that it conforms to the JavaRanch naming policy.