Overview of JSF Architecture

The architecture of JSF is not completely unlike other MVC architectures you’ve probably encountered when building web applications. In fact, some of its pieces should be quite familiar now that you’ve read this book. However, JFS adds functionality in several places where Struts is lacking, and it does so a way that separates interface from implementation. As stated earlier, this is an important (but often overlooked) quality.

Because it’s built around the MVC concept, you might expect to see models, views, and controllers in JSF. And while these elements are all present in JSF, the web imposes some distinct limitations on the MVC model. Let’s look at a simplified scenario of how a traditional MVC architecture works:

  1. The view responds to user actions by invoking methods on the controller.

  2. The controller interacts with the model and updates it.

  3. The model creates and publishes events that views and controllers respond to by updating themselves.

Unfortunately, these steps don’t work in the web world. Web browsers rarely sit and wait for an event to be published. Instead, they make a request for information and then expect that information to be returned—they are certainly not preconditioned to listen for events.

JSF’s approach is to provide components to handle the controller aspects of the application. These include the FrontController (similar to the Struts ActionServlet), NavigationHandler , conversion and formatting components, ActionListeners to interpret ...

Get Programming Jakarta Struts, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.