Struts and the Model

 < Day Day Up > 

The Struts framework does not provide any specific features or constraints for developing the Model layer of your application. At first glance this may seem odd, or even a shortcoming, given that Struts is designed for building MVC applications. However, it’s actually a key design feature of Struts and is a great benefit. By not dictating how the Model layer should be built, Struts gives your application the flexibility to use any approach or technology for building the Model layer code. Whether it be Enterprise JavaBeans (EJB), Java Data Objects (JDO), or the Data Access Objects (DAO) pattern, Struts will accommodate.

Because the Model defines the business logic, the Model is where Struts ends and your application code begins. Your Model code will be accessed from subclasses of Struts’ Action object that are part of the Controller layer of the Struts framework. Action subclasses interact with the Model via Action’s interfaces and use its Data Transfer Objects to pass and retrieve data.

You should not place any business logic or data access code in Action objects. Doing so would bypass the separation of the Model and the Controller. Similarly, your Model code should not have any references to Struts code or objects. Violating this rule unnecessarily couples your core application code to Struts.

 < Day Day Up > 

Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2003
Pages: 134
Authors: James Holmes

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: