Home | Login | Blog | Forum | Download | RSS Feed | Ajax | Hello-World | J2EE | BPM | EJB | FileNet | Hibernate | ORM | IBM | ILOG | Interview | FAQs |

Java | Apache | JVM | Others | BRMS | Oracle | Pega | SOA | Sun-Certification | Web-Service | websphere | XML |
 

JAVA DEVELOPER SITE - COMPLETE JAVA TUTORIALS

Model View Controller (MVC) Architecture


Share
 
 

Useful Java Links


       


MVC Architecture

 

MVC is a design pattern used in most of theenterprise applications. The MVC (Model-View-Controller) architecture dividesthe web-based application into threeparts: the model, the view and the controller.

Thereare two types architecture used by web-based applications

 

Model1- This is page centric design pattern. Here JSP page alone responsible forprocessing the incoming request and replying back to the user. This architectureis good for simple applications not for complex applications. Here large amountof Java code required for data processing embedded inside the JSP page. Thisresults in a messy flow of control and design ugliness for the application.Maintenance will be nightmare for the application developed using Model 1architecture.

 

The following diagram represents the Model-1architecture

 


 

Model2 (MVC) –

Model View Controller or model 2 architecture is to separate the  business logic and application data from the presentation  data to the user.  

 

Following diagram illustrate MVC Pattern in details:

 

           


 

Model

A model represents an application’s data and contains the logic for accessing and manipulating that data. Any data that is part of the persistent state of the application should reside in the model objects. The services that a model exposes must be generic enough to support a variety of clients. By glancing at the model's public method list, it should be easy to understand how to control the model's behavior. A model groups related data and operations for providing a specific service;

these group of operations wrap and abstract the functionality of the business process being modeled. A model’s interface exposes methods for accessing and updating the state of the model and for executing complex processes encapsulated inside the model. Model services are accessed by the controller for either querying or effecting a change in the model state. The model notifies the view when a state change occurs in the model.

 

View

The view is responsible for rendering the state of the model. The presentation semantics are encapsulated within the view, therefore model data can be adapted for several different kinds of clients. The view modifies itself when a change in the model is communicated to the view. A view forwards user input to the controller.

 

Controller

The controller is responsible for intercepting and translating user input into actions to be performed by the model. The controller is responsible for selecting the next view based on user input and the outcome of model operations. The controller is often programmed as a Java Servlet.

 

Advantages of MVC Architecture:

 

They are reusable :  we can reuse  Model components. The separation of model and view allows multiple views to use the same enterprise model.

 

When the problem recurs, there is no need to invent a new solution; we just have to follow the pattern and adapt it as necessary.

 

We can easily support a new types of clients using MVC architecture. To do this we only need to write a view and some control logic and then wire them to the existing enterprise application.

 

They are expressive: By using the MVC architecture our application becomes more expressive.

 

Many technology implement MVC design pattern. such as Struts, Spring.

 

Example of MVC architecture:

 

When the user submits Registration form, a request is sent to the controller that is servlet handler.

 

The servlet handler dispatches the request to the appropriate control class here its is .ResgistrtionAction

 

The Control performs the action requested by the user on the Model ResgistrionForm model

 

The Model returns a response; in this example, a successful submission of the registration form.




Download Latest Java/J2EE eBooks, SCJP Dumps, SCWCD Dumps, Pega Tutorial, IBM WebSphere BPM tutorials and many more


If you need any urgent assistance on model-view-controller-architecture, kindly email your requirement to us at : info@javagenious.com or Contact-an-Expert. Our experts will try their best to solve your problem.

You can also subscribe to our newsletters on model-view-controller-architecture, to receive updates on model-view-controller-architecture,via email.Enter you email below:

Enter your email address:

Delivered by FeedBurner



Keyword Tags: model-view-controller-architecture tutorial,model-view-controller-architecture in java,Concepts of model-view-controller-architecture,Java,J2EE,Interview Questions,model-view-controller-architecture Examples


Comments:


Post Your Comment:

*

Yes, I would like to recieve email notifications on my reply.

Popular Posts:

 
Popular Downloads

SCJP 1.6 Dumps
JSP Interview Questions
Struts Interview Questions
Hibernate Interview Questions
SCWCD Dumps
SCBCD Dumps

Java/J2EE Tutorial
JMS Tutorials
seam richfaces tutorial
richfaces live demo
jquery example demo
JQuery Tutorial and Source Code
JSF Tutorial
XSL Tutorial
J2EE JMS
CORBA Applications
Java CERTIFICATION
SCJP 1.5
SCJP 1.6
SCWCD 1.5
SCBCD
Mis
Ajax autosuggest autocomplete from database
Struts forms and validation with webflow
Java Apache POI Examples
JDBC Tutorial
Oracle 9i & 10g
MYSQL Tutorial
php Tutorial
JQuery Examples
Upload Java File
JAXB Examples
PL-SQL Tutorial
Dojo AJAX
EJB Examples
Java IDE
Eclipse
NetBeans
IBM Rational Weblogic Workshop
Downloads
SCJP 1.6 Dumps
SCJP 1.5 DUMP
SCJP Material
SCWCD
Java Security
SCBCD Dumps
External Links
SUN Java
JOracle
IBM
PHP Certification
Technical Interview Questions
Amazon Interview Questions
Google Interview Questions
Microsoft Interview Questions
IBM Interview Questions
Yahoo Interview Questions
All Tutorials
php mysql tutorial
SCJP 1.5/1.6
SCWCD 1.5/1.6
Polymorphism
Thread Tutorial
Generics & Exceptions
Spring Struts Hibernate
Java Collections
MAP
SET
LIST
VECTOR
Advanced Java
Stateless Session Bean
Introduction to EJB
Stateful Session Bean
Java Design Patterns
HOME | FORUM | ABOUT | BLOGS | CONTACT-US