Recent changes RSS feed
 

Page Controller

A Page Controller is one object or file declaration designed to handle the request for one logical web page or action.

With a simple mapping between a page request (URL) and files, this is the default pattern for scripting solutions (PHP, ASP, JSP). A single file handles the request for a specific page. This simple mechanism mirrors how static web pages are handled.

Scripting solutions provide a poor separation between the view and the controller when implementing a Model View Controller architecture. This can make testing and reuse difficult. Also See Template View for separating the View from other application logic.

The primary responsibility of the page controller as part of Model View Controller is to process input and coordinate the model and the view. The page controller extracts information from the web server request and invoke an action on the model or calls a view based on that information. Page controller is distinguished from a Front Controller in that the page controller operates on only a single logical page, where a Front Controller performs this functions for a set of logical pages.

Page Controllers are useful on web sites with static navigation structures.

Base Controller

When multiple page controllers share duplicate logic, a common practice is to move that logic to a base page controller which each page controller can inherit from. This is one way of implementing Centralized Request Logic.

ASP.NET provides a special mechanism for implementing base controllers in scripts, called Code Behind.

When the base controller class begins to have special case logic in it for types of requests, it might be a good idea to consider a Front Controller instead.

Additional Information

 
pattern/page_controller.txt · Last modified: 2006/12/09 17:14
 
Hosting for this site donated by Procata PHP Development