docs.intersystems.com
MultiValue Quick Start Tutorial
Zen Model–View–Controller
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Search:    

Now we implement the data entry form for the application using the Zen Model–View–Controller (MVC) framework. The Zen MVC framework allows us to quickly and easily implement a model–view–controller design. It can dramatically simplify an application's code for displaying and updating data.

An MVC architecture separates an application's data (model) from its user interfaces (view) by inserting a layer of code (the controller) between the two. The controller code updates the model in response to user interaction with the view and updates the view in response to changes in the model. This decoupling of data from presentation provides a number of benefits including much greater code simplicity and flexibility.
To create our data entry form, we implement the following three Application Elements:
Zen MVC in the Data Entry Form
Application Element Description MVC Element
Extends %ZEN.DataModel.ObjectDataModel. Correlate the MVFILE.PersonModel properties with MVFILE.PERSON properties to include them in the model. Implement callback methods in MVFILE.PersonModel that retrieve, update, and create MVFILE.PERSON instances. Code these method using MVBASIC.
Model
Zen form component.
Connect the form component to the controller and bind each input element on the form to properties of the model class.
View
Zen dataController component.
Place this component on the page and connect it to both the form component and the model class. Controller
Note:
To learn more about Zen MVC, read Model View Controller in Using Zen Components.
For another Zen MVC example, read Part III: Updating Data using a Form and Zen MVC in the Zen QuickStart Tutorial.


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA