At one end of a typical web application is the presentation layer. Many Java developers understand what Struts provides. However, too often, coupled code such as business logic is placed into an org.apache.struts.Action. So, let's agree on what a framework like Struts should provide. Here is what Struts is responsible for:
- Managing requests and responses for a user.
- Providing a controller to delegate calls to business logic and other upstream processes.
- Handling exceptions from other tiers that throw exceptions to a Struts Action.
- Assembling a model that can be presented in a view.
- Performing UI validation.
Here are some items that are often coded using Struts but should not be associated with the presentation layer:
- Direct communication with the database, such as JDBC calls.
- Business logic and validation related to your application.
- Transaction management.
- Introducing this type of code in the presentation layer leads to type coupling and cumbersome maintenance.
Excerpt from "Wiring Your Web Application with Open Source Java" by Mark Eagle
[Note:This blog was migrated from my very old blog which was in the blogspirit.]
Software Programming,Open Source
Programming