Download FAQ History |  | API Search Feedback

> ## Interactive Web Application Architectures

> The Model-View-Controller (MVC) architecture is a widely-used architectural approach for interactive applications. The MVC architecture separates functionality among application objects so as to minimize the degree of coupling between the objects. To achieve this, it divides applications into three layers: Model, View, and Controller. Each layer handles specific tasks and has responsibilities to the other layers:

> - The Model represents business data and business logic or operations that govern access and modification of this business data. The model notifies views when it changes and provides the ability for the view to query the model about its state. It also provides the ability for the controller to access application functionality encapsulated by the model.
> - The View renders the contents of a model. It gets data from the model and specifies how that data should be presented. It updates data presentation when the model changes. A view also forwards user input to a controller.
> - The Controller defines application behavior. It dispatches user requests and selects views for presentation. It interprets user inputs and maps them into actions to be performed by the model. In a Web application, user inputs are HTTP GET and POST requests. A controller selects the next view to display based on the user interactions and the outcome of the model operations.

> When employed in a Web application, the MVC architecture is often referred to as a Model-2 architecture. A Web application that intermixes presentation and business logic employs what is known as a Model-1 architecture. The Model-2 architecture is the recommended approach for designing Web applications.

Download FAQ History |  | API Search Feedback

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.