1

From the wiki page about JSF I've learnt that it's considered as an MVP framework. But I cannot realy understand why.

Actully, beans do not contain a reference to View in themselves. There's also a data bidinig mechanism between Facelets and Managed beans.

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.

QUESTION: Why is JSF considered MVP but not MVVM framework?

Community
  • 1
  • 1

1 Answers1

1

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • _there would be a controller in the client side_ Not quite clear why that. In [the MVVM Wikipedia description](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) there's no clear restrictions about where ViewModel (client or server for web applications) should be. And one more thing. What is the presenter in JSF then. Managed beans could be used in several different facelets... I would not call them presenters. –  Apr 13 '16 at 14:19
  • The view technology is the presenter. Previously this was set "hard" to JSP. Since JSF 1.2, the API allows defining a different presenter via `ViewHandler`. This is later finetuned to [`ViewDeclarationLanguage`](http://docs.oracle.com/javaee/7/api/javax/faces/view/ViewDeclarationLanguage.html) (VDL), hereby basically moving from MVC to MVP. XML based presenters were invented, among others Facelets which became the default presenter since JSF 2.0. There are even (experimental) pure Java based presenters, you can find several on Google using keyword [JavaVDL](http://google.com/search?q=javavdl). – BalusC Apr 13 '16 at 20:43