Communication between the View and Model in MVC

喜欢而已 提交于 2019-12-09 09:23:39

问题


After reading from many different sources, I am very confused about how View and Model should communicate in the MVC pattern. To my understanding, the accepted answer of this post and this article from Apple are saying the communication of the two should be done through controller. While the MVC page in Wikipedia, the ASP.NET MVC page, and this article in MSDN are showing there is a direct association between View and Model. So according to the answer in here, what the article from Apple is referring to is actually MVP not MVC then? Thank you for any help!!


回答1:


There is more than one answer. Eventually you can do whatever you thing suits your needs. I use a controller + ViewModels to connect to the view. The view never use the model. just what the controller gives him.

There is a nice explanation of all models in steven sandarson book, Page 49 (variation on MVC).



来源:https://stackoverflow.com/questions/6206523/communication-between-the-view-and-model-in-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!