|
|
|
| HOME | J2ME | Struts | AJAX | SOAP | SOA | MEDIA STREAMING | AXIS | | |
|
|
Struts for Beginners: Model View Controller (MVC) Design PatternBack | Tutorial Home | Next Every program has a User Interface, event handling, business logic and data access. If these components are mixed together what we get is a spaghetti code. This kind of code though functional is difficult to maintain and small changes to a part of code will have a spiral effect to other sections of the program. To get around this problem Model View Controller approach was developed by small talk developers and was widely embraced by the developer community. Various Java technologies like Swing, J2EE, Struts draw a lot of features from MVC design pattern. In MVC the programs are divided into three parts Model, View and Controller. This way there is segregation of various layers and the changes can be done to individual layers without effect or minimal effect to the other layers. Lets us look into these layers in more detail View View manages the display to the end user. View should not contain any business logic.This layer does following tasks
If you are web programmer these are your JSP files. Model Model is back bone of any program. This modal consists of data in a particular state and actions that can modify this state. These actions are usually called business logic. In simpler words this layer does all the data related work given below
If you are web programmer these are your BOs (Buisness Objects), DAOs (Data Access Objects) , VOs(Value Objects) etc. Controller
Controller is the layer between View and Model. This layer does following tasks
If you web programmer these are your Servlet files. As you go through next few sections you will understand how this design pattern is implemented in Struts. Back | Tutorial Home | Next site comments powered by Disqus |
|
| toolbar powered by Conduit |
|
| Copyright © 2009. All rights reserved | Terms and Conditions | About | Contact | Feed Back | |