Originally posted by Bruno Arantes:
Placing your data-access or other business-related logic in the ActionForm will couple your system to Struts, and that's not a good idea when you think about portability, scalabity, etc...
Well, if you use the Struts framework components, then you are
already coupled to it. What you want to do is to minimize the coupling and make sure that whatever coupling is there is at the right places. This is probably what you meant anyway.
As you indicated, the ActionForm would be a bad place for tying in your business logic. Methods should do one thing. The validate method should do just that.
Business logic should be loosely coupled to the Controller part of Struts: the Action. For simpler apps, the business logic can go in the Action itself. If you want to loosen the coupling and add one more layer or two, you'd probably have the Action
delegate work to your "business classes" that encapsulate the business logic. The business class will then interface with your persistence class that access the DB.
I normally start out with simple business logic in the Action then refactor the logic out to a business class as needed.