

The view registers as a listener on the model.Once the model, view, and controller objects are instantiated, the following occurs: This section will take a closer look at one way to implement Figure 1 in the context of an application in the Java Platform, Standard Edition 6 (Java SE 6). A Common MVC Implementation Interaction Between MVC Components Depending on the context, a controller may also select a new view - for example, a web page of results - to present back to the user.įigure1. In a stand-alone GUI client, user interactions could be button clicks or menu selections, whereas in an enterprise web application, they appear as GET and POST HTTP requests. Controller - The controller translates the user's interactions with the view into actions that the model will perform.This can be achieved by using a push model, in which the view registers itself with the model for change notifications, or a pull model, in which the view is responsible for calling the model when it needs to retrieve the most current data.

If the model data changes, the view must update its presentation as needed. It specifies exactly how the model data should be presented. View - The view renders the contents of a model.In enterprise software, a model often serves as a software approximation of a real-world process. Model - The model represents data and the rules that govern access to and updates of this data.More precisely, MVC can be broken down into three elements: MVC was first introduced by Trygve Reenskaug, a Smalltalk developer at the Xerox Palo Alto Research Center in 1979, and helps to decouple data access and business logic from the manner in which it is displayed to the user. If you've programmed with graphical user interface (GUI) libraries in the past 10 years or so, you have likely come across the model-view-controller (MVC) design.
