分类: 系统运维
2008-03-06 10:44:15
两阶段视图
Turns domain data into HTML in two steps: first by forming some kind of logical page, then rendering the logical page into HTML.
通过两阶段把域数据转化为HTML:首先形成一些逻辑页, 然后把逻辑页显示为HTML.
完全的描述请参考 365 页
If you have a Web application with many pages, you often want a consistent look and organization to the site. If every page looks different, you end up with a site that users find confusing. You may also want to make global changes to the appearance of the site easily, but common approaches using Template View (350) or Transform View (361) make this difficult because presentation decisions are often duplicated across multiple pages or transform modules. A global change can force you to change several files.
如果你有一个有很多页面的WEB应用, 你经常需要站点有一个一致的外观和组织.如果没一个页面外观不容,那样的站点将使用户感觉到混乱.你也可能希望当要对站点进行全局的改变容易些, 通常的使用 模板视图 或者 转换视图 的做法有点困难,因为一些表现效果经常要在多页进行复制.一个全局的改变可能迫使你改变很多页面.
Two Step View deals with this problem by splitting the transformation into two stages. The first transforms the model data into a logical presentation without any specific formatting; the second converts that logical presentation with the actual formatting needed. This way you can make a global change by altering the second stage, or you can support multiple output looks and feels with one second stage each.
两阶段视图正是通过分离转化到两阶段来解决这个问题.首先转化模型数据到没有特定格式的逻辑表现页; 然后把逻辑页面转化到实际需要的格式. 这种方法可以通过修改第二阶段来改变全局效果, 或者你可以支持多种输出外观.