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 (PHPASP, 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 aFront 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 implementingCentralized 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.

当多个页面控制器拥有共同的逻辑时,一个常见的经验就是把共同逻辑移到base page controller,页面控制器继承基类。这是实现集中请求逻辑的方式。

当base controller开始对不同的请求有不同的处理逻辑时,这是考虑前段控制器是一个好主意,

上面转自:http://www.phpwact.org/pattern/page_controller

martin fowler解释:

page controller: An object that handles a request for a specific page or action on a Web site.

Most people's basic Web experience is with static HTML pages. When you request static HTML you pass to the Web server the name and path for a HTML document stored on it. The key notion is that each page on the Web site is a separate document on the server. With dynamic pages things can get much more interesting since there's a much more complex relationship between path names and the file that responds. However, the approach of one path leading to one file that handles the request is a simple model to understand.

As a result, Page Controller has one input controller for each logical page of the Web site. That controller may be the page itself, as it often is in server page environments, or it may be a separate object that corresponds to that page.

参考:http://www.martinfowler.com/eaaCatalog/pageController.html

更多:http://www.onlamp.com/pub/a/php/2004/10/14/page_controller.html

http://www.uml.org.cn/sjms/200812302.asp

Page Controller页面控制器实现的更多相关文章

  1. Salesforce学习之路-developer篇(三)利用Visualforce Page实现页面的动态刷新案例学习

    Visualforce是一个Web开发框架,允许开发人员构建可以在Lightning平台上本地托管的自定义用户界面.其框架包含:前端的界面设计,使用的类似于HTML的标记语言:以及后端的控制器,使用类 ...

  2. Salesforce学习之路(六)利用Visualforce Page实现页面的动态刷新功能

    Visualforce是一个Web开发框架,允许开发人员构建可以在Lightning平台上本地托管的自定义用户界面.其框架包含:前端的界面设计,使用的类似于HTML的标记语言:以及后端的控制器,使用类 ...

  3. Controller 接口控制器详解

    Controller 控制器,是 MVC 中的部分 C,为什么是部分呢?因为此处的控制器主要负责功能处理部分:1.收集.验证请求参数并绑定到命令对象:2.将命令对象交给业务对象,由业务对象处理并返回模 ...

  4. SpringMVC(4.1):Controller接口控制器详解(1)

    原文出处: 张开涛 4.1.Controller简介 Controller控制器,是MVC中的部分C,为什么是部分呢?因为此处的控制器主要负责功能处理部分: 1.收集.验证请求参数并绑定到命令对象: ...

  5. springMVC之一(页面<--->控制器 互相传值,转发和重定向)

    #页面--->控制器1.request:不建议使用2.使用属性传值(建议使用)@RequestParam("name") String username3.使用Bean对象传 ...

  6. 实现接口Controller定义控制器

    实现接口Controller定义控制器 控制器提供访问应用程序的行为,通常通过服务接口定义或注解定义两种方法实现. 控制器解析用户的请求并将其转换为一个模型.在Spring MVC中一个控制器可以包含 ...

  7. Controller接口控制器

    1.Controller简介 Controller控制器,是MVC中的部分C,为什么是部分呢?因为此处的控制器主要负责功能处理部分: 1.收集.验证请求参数并绑定到命令对象: 2.将命令对象交给业务对 ...

  8. Spring MVC 使用介绍(三)—— Controller接口控制器

    一.概述 Controller接口类图如下,其中,BaseCommandController已从Spring 4移除 基于继承Controller接口的方式已经不推荐使用,仅供学习参考 二.基于Con ...

  9. Page Object页面设计模式核心要点

      Page Object,页面对象.一种设计模式,实施selenium的最佳实践,体现了web应用与页面显示之间的关系.为什么需要Page Object?测试代码维护的需要:减少代码的编码量,减少代 ...

随机推荐

  1. 完美:adobe premiere cs6破解版下载[序列号+汉化包+破解补丁+破解教程]

    原文地址:http://blog.sina.com.cn/s/blog_6306f2c60102f5ub.html 完美:adobe premiere cs6破解版下载,含序列号.汉化包.注册机.破解 ...

  2. Adroid APPIUM实例步骤

      1.下载eclipse 2.安装java 配置环境变量 3.eclipse 安装adt android development tools 4.android sdk manager 安装tool ...

  3. 域名地址默认跳转到www(301重定向)

    要做这个操作之前,你首先必须肯定要有一个域名..... 然后域名指向了某一个外网主机地址,能正常访问网站 IIS7之后版本的看客继续往下看,IIS7之前的版本,请止步,我没有对之前的版本做过 首先确认 ...

  4. Android自定义控件(二)——有弹性的ScrollView

    本文在http://gundumw100.iteye.com/blog/1075286的基础上稍作修改, 实现了当手指滑动到ScrollView的顶部.底部时, 可以继续的向上.向下拉伸.当释放手指的 ...

  5. 使用apktool解包和打包apk

    使用apktool解包和打包apk 下载apktool工具 解包 apktool d xxx.apk -f 植入代码 使用apktool解包要植入代码的apk(下面称为A), 使用apktool解包包 ...

  6. fread(),fwrite() 读/写流

    C 库函数 - fread() 描述 C 库函数 size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) 从给定流 strea ...

  7. 让DIV垂直居中的几种办法

    1.使用CSS3 的伸缩盒布局 <!doctype html> <html> <head> <meta charset="utf-8"&g ...

  8. OWIN初探(转)

    什么是 OWIN ? OWIN 的全称是 "Open Web Interface for .NET", OWIN 在 .NET Web 服务器和 .NET Web 应用之间定义了一 ...

  9. RAID磁盘阵列原理

    磁盘阵列(Redundant Arrays of independent Disks,RAID),有“价格便宜具有冗余能力的磁盘阵列”之意.原理是利用数组方式来作磁盘组,配合数据分散排列的设计,提升数 ...

  10. oracle包概述(一)【weber出品】

    一.PL/SQL包概述 1. 什么是PL/SQL包: 相关组件的组合:PL/SQL类型.变量,数据结构,和表达式.子程序: 过程和函数 2. 包的组成部分: 由两部分组成: 包头 包体 3. 包的优点 ...