MVC template. The relationship between model, view and controller

The relationship between Model, View and Controller confuses me.

This section shows the View to Controller arrow shape, the Controller to Model arrow and the Model to View arrow: http://www.codeproject.com/Tips/31292/MVC-vs-MVP-How-Common-and-How- Different

However, this section shows the double arrow between Model and View; double arrow between view and controller; and arrow from controller to model: http://www.codeproject.com/Articles/288928/Differences-between-MVC-and-MVP-for-Beginners

Finally, this section shows an arrow from View to Model, an arrow from Controller to Model, and an arrow from Controller to View: http://www.w3schools.com/aspnet/mvc_intro.asp

I have a few questions:

  • Which relationship is right?
  • Should business logic be handled in a controller or model? I read somewhere that business logic cannot be hosted in a controller (ASP.Net MVC)
  • If the controller passes the object to the view, is this object owned by the model?
  • How does a view retrieve data directly from a model? Does it have a link directly to the model, or does it interact with the model coming from the controller?
+4
source share
1 answer

I find all the images that you link to confuse. This image ( taken from Wikipedia ) best explains this.

MVC diagram

How it works

MVC . - , . , , .

. , - , , HTML- . - ; MVC: . , . , .

- Martin Fowler

  • MVC - , .
  • - . .
  • ( )
  • . ( ) . , / .
+7

All Articles