e.Front Controller

  1. Motivation

    1. Used to implement controller part of MVC pattern for very complex UI navigation logic

  2. Summary

    1. Front Controller solves the decentralization problem present in Page Controller by channeling all requests through a single controller.

    2. The controller itself is usually implemented in two parts: a handler and a hierarchy of commands.

            1. Front Controller structure

            1. Front Controller, typical scenario

  1. When to Use

      1. You have decided to use the Model-View-Controller(MVC) pattern for your dynamic Web application.

      2. You have reviewed the Page Controller pattern, but your page controller classes have complicated logic, are part of a deep inheritance hierarchy, or your application determines the navigation between pages dynamically based on configurable rules.

  2. Related Patterns

      1. Intercepting Filter. This pattern describes another way to implement recurring functionality inside a Web application. Filters tend to deal with lower-level functions such as decoding, authorization, authentication, and session management where as Front Controller and Page Controller deal with application-level functionality.

      2. Page Controller. This pattern is a simpler alternative to Front Controller. Page Controller has a single controller object per page as opposed to the single object for all requests. Page Controller is a more appropriate starting point for most applications. Only when the need arises should you turn to Front Controller.

  1. Specific Considerations

    1. Page Controller Vs Front Controller

      1. Page Controller is a more appropriate starting point for most applications. Only when the need arises should you turn to Front Controller.

  1. References