Sunday, March 14, 2010

JInt Demo: Implementing MVC Architecture using Struts

Introduction

Struts is an open source framework from Apache Jakarta for building applications using Model View Controller (MVC) design pattern. Struts provide the basic infrastructure for implementing MVC allowing developers to concentrate on the business logic. The framework is also flexible and can be extended to meet the requirements specific to a project.
The objective of this article is to help users quickly get started with using Struts in their applications. It also shows how JInt Demo uses Struts to implement (MVC) architecture in its Web applications.

MVC Architecture

The aim of MVC architecture is to separate the business logic and data of the application from the presentation of data to the user. Following is the small description of each of the components in MVC architecture:
Model : The model represents the data of an application. Anything that an application will persist becomes a part of model. The model also defines the way of accessing this data ( the business logic of application) for manipulation. It knows nothing about the way the data will be displayed by the application. It just provides service to access the data and modify it.
View : The view represents the presentation of the application. The view queries the model for its content and renders it. The way the model will be rendered is defined by the view. The view is not dependent on data or application logic changes and remains same even if the business logic undergoes modification.

Controller : All the user requests to the application go through the controller. The controller intercepts the requests from view and passes it to the model for appropriate action. Based on the result of the action on data, the controller directs the user to the subsequent view.

Click here to get started with Struts>>>>

original article: http://www.oracle.com/technology/sample_code/tech/java/j2ee/jintdemo/tutorials/Struts.html

 

No comments:

Post a Comment