Model 2 Front Controller architecture

In the basic version of Model 2 architecture, the requests from the browser are handled directly by different servlets (or Controllers). In a number of business scenarios, one would want to do a few common things in servlets before we handle the request. An example would be to ensure that the logged-in user has the right authorization to execute the request. This is a common functionality that you would not want to be implemented in every servlet.

In Model 2 Front Controller architecture, all requests flow into a single controller called the Front Controller.

Picture below represents typical Model 2 Front Controller architecture:

The following are some of the responsibilities of a typical Front Controller:

  • It decides which Controller executes the request
  • It decides which View to render
  • It provides provisions to add more common functionality
  • Spring MVC uses an MVC pattern with Front Controller. The Front Controller is called DispatcherServlet. We will discuss DispatcherServlet a little later.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset