为什么JSF被认为是MVP而不是MVVM框架 [英] Why is JSF considered MVP but not MVVM framework
问题描述
从有关JSF的Wiki页面中,我了解到它被视为MVP框架.但是我真的不明白为什么.
From the wiki page about JSF I've learnt that it's considered as an MVP framework. But I cannot realy understand why.
实际上,bean本身并不包含对View的引用. Facelets和托管Bean之间还有一个数据双向机制.
Actully, beans do not contain a reference to View in themselves. There's also a data bidinig mechanism between Facelets and Managed beans.
因此,我想说受管Bean比Presenter
更多ViewModel
,因为Presenter
通常本身包含一个View
接口,例如
So I would say that Managed Beans are more ViewModel
than Presenter
, as that Presenter
usually contain a View
interface in itself like in that example.
问题 :为什么JSF被认为是MVP而不是MVVM框架?
QUESTION: Why is JSF considered MVP but not MVVM framework?
推荐答案
MVVM主要是面向桌面应用程序的模式.从Web应用程序角度考虑MVVM时,客户端中将有一个控制器. JSF没有这样的.当您仍在谈论网络应用程序时,例如服务器端的Spring MVC,例如在客户端使用AngularJS或Node.js,您可能会谈到MVVM.
MVVM is mainly a desktop application oriented pattern. When considering MVVM in web application perspective, there would be a controller in the client side. JSF doesn't have such one. When still speaking about web applications, if you were using e.g. Spring MVC in server side with e.g. AngularJS or Node.js in client side, you may speak about MVVM.
这篇关于为什么JSF被认为是MVP而不是MVVM框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!