Home >ESP Guide> Model-View-Controller Framework

Quick Nav

See Also

Model-View-Controller Framework

The Model-View-Controller (MVC) paradigm is a design pattern for creating applications. It partitions the separate concerns of application data, user interface and application logic into three discrete components. It has proven highly successful in simplifying application design and maintenance.

mvc

The ESP Web Framework is a Model-View-Controller environment that provides a structure and assistance for your MVC application. It provides the basis and connections between your models, views and controllers and routes messages between the various components.

Models

The model is responsible for managing access to application data and state. It is also responsible for ensuring the data remains valid and consistent.

ESP provides a basic Object Relational Mapper (ORM) via the Embedded Database Interface (EDI). This wraps database data in a "C" language Record and Grid data structure. It then allows you to use object-oriented programming (OOP) when dealing with database data stored in rows and columns.

Views

The view is responsible for rendering the user interface and presenting the application to the user. Views should not manage incoming requests — that is the job of Controllers.

ESP provides the ESP web pages to assist in creating view web pages. ESP web pages are HTML pages with embedded "C" code. They are compiled and run to render the user interface. The ESP view mechanism also provides a templating engine so you can deal separately with layout pages and content pages.

Controllers

Controllers manage the application and respond to client requests. They orchestrate the application's response, they access and update model data, and display views back to the client. Incoming requests invoke Actions in the controller which modify the application state and ultimately render a view.

ESP routes requests by parsing and decoding request URIs and matching them with the appropriate Controller and Action function.

© Embedthis Software LLC, 2003-2013. All rights reserved. Embedthis, Appweb, ESP, Ejscript and Embedthis GoAhead are trademarks of Embedthis Software LLC.