Oct 26, 2018

MVC Pattern of JSF

The way JSF approaches MVC is that the whole 3 components reside on the server side:

  • The Model is a tree of plain Java objects
  • The View is a server side template defined in XML that is read to build an in-memory view definition
  • The Controller is a Java servlet, that receives each request and processes them through a series of steps

The browser is assumed to be simply a rendering engine for the HTML generated at server side. Ajax is achieved by submitting parts of the page for server processing, and requesting a server to ‘repaint’ only portions of the screen, without navigating away from the page.

JSF removes the need of all the boilerplate of gathering HTTP request parameters, converting/validating them, updating the model values, executing the right Java method to do the business stuff and generating the HTML/CSS/JS boilerplate code. With JSF you basically end up with a XHTML page as view definition and a Javabean class as model definition. This greatly speeds up development.