Struts is a MVC-based framework. The application's business logic, including data CRUD operations are part of the Model application (aka Business Object Model).
A Struts Action class is part of the Controller. This is how you create a Controller for your specific application.
What does this mean? When programming with Struts,
you should avoid writing business logic code in the Action class. This includes any operations that "save" data in a database.
In your example, the execute() method and a DAO object are tightly coupled. This mean that you have coded business logic in your Controller code, not a business object. Your are missing a business object.
The purpose of a Data Access Object is to encapsulate the "data access logic" and shield your "business logic" from the details, e.g. syntax, of the data access logic.
If you pollute the code of the Controller with "data access logic", e.g. Hibernate statements, you introduce a significant dependency upon the implementations. This is not acceptable in enterprise software. It is ok for Jim's marketing website with 100 visitors per month.
If you pollute the business logic with hard-coded syntax of your ORM implementaiton, you introduce a significant dependency. The overall objective is to foster "low coupling" between components, not "hard-coded" dependencies.
Again for emphasis, there is a difference between large-scale systems and Sayeed's
Java Codes Interview Questions website
