求助:英文翻译 50

MVCConceptsandtheFrontControllerJ2EEPatternLet'slookinmoredetailatwhatitmeanstoadopta... MVC Concepts and the Front Controller J2EE Pattern
Let's look in more detail at what it means to adopt an MVC approach to web applications. In this section we'll consider theory and general principles. In the next section we'll look at some real MVC web frameworks that simplify the implementation of applications using an MVC approach.
The MVC Triad
The MVC approach divides components into three kinds of object: model data objects; view objects that present model data on screen; and controller objects that react to user input, updating models appropriately.
In a true MVC architecture, such as that of Java's Swing GUI libraries, each view registers with a model, which publishes events when its data is updated. Consider the Swing JList component. This simple view component displays items in a list and allows item selection. The list data is defined in an object implementing the ListModel interface, which publishes ListDataEvents when the data changes. The JList view component provides a ListDataListener implementation that registers with the ListModel and updates the display as events are received. This is a push model: the model pushes notifications to any number of listeners, which are typically (but not necessarily) views.
As changes in a web application are usually only displayed to the user when a request is received and a new page is generated, the push model doesn't work. Hence a web application view will only render once. It won't help to register it to receive ongoing notifications. The solution is to use a pull model, in which a view is given access to the models required to render a dynamic page, and the view pulls data from the model as necessary. Since a web page may contain different controls and sections of dynamic data, more than one model may be required to back it.
Whether we use a push or pull model, the MVC architecture still delivers its key benefits. Each component type has a clear responsibility. Models contain no view-specific code. Views contain no control code or data-access code and concentrate on displaying data. Controllers create and update models; they do not depend on particular view implementations.
Although the MVC approach has the potential to improve web-tier code tremendously, it is a little complex to set up. Thus we will generally use a generic MVC web application framework, rather than implement the pattern ourselves.
展开
 我来答
地狱001
2008-05-12 · 超过14用户采纳过TA的回答
知道答主
回答量:109
采纳率:0%
帮助的人:57.7万
展开全部
让我们看看更详细地在它的意思采取MVC的方法Web应用程序。在本节中,我们会考虑理论和一般原则。在下一节中我们将看看一些真正的MVC的Web框架,简化执行的申请,使用MVC的方法。
该MVC的黑社会
该MVC的做法,划分为组件到三种对象:模型的数据对象;查看对象,目前模型数据在屏幕上;控制器的对象作出反应,用户输入,更新模式,妥善处理。
在一个真正的MVC架构,例如像Java的的摆动贵图书馆,每个视图登记与模型,出版活动时,其数据是更新。考虑摆动jlist的组成部分。这个简单的检视组件显示的项目清单,并允许项目的选择。清单中的数据是指在一个对象实施listmodel接口,出版listdataevents当数据的变化。该jlist查看组件提供一listdatalistener实施登记与listmodel和更新显示为活动收到。这是一个推动模型:模型推通知任何数目的听众,这是通常(但不一定)的意见。
为改变在Web应用程序通常只向用户显示,当收到请求书和新的一页,是产生,推动的模式是行不通的。因此, Web应用程序的看法,只会使一次。它不会帮助它注册接收正在进行的通知。解决的办法是使用拉模型,在这种看法是获得所需的模型,使一个动态的网页,并认为,中调用数据,从模型中作为必要的。由于网页可能含有不同的管制和路段的动态数据,一个以上的模型可能需要将它备份。
我们是否使用,推动或拉动的模式, MVC的架构仍然提供其主要优点。每个组件类型有一个明确的责任。模型不包含的观点的具体代码。意见不包含控制代码或数据访问代码和专注于显示数据。控制器创建和更新模型;他们不依赖于特定视图的实现。
虽然MVC的方法有可能,以改善Web的三层代码极大,这是一个不大复杂的成立。因此,我们通常会使用一个通用的MVC的Web应用框架,而不是实施自己的模式
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
超笑更易火1d
2008-05-12 · TA获得超过3778个赞
知道小有建树答主
回答量:442
采纳率:0%
帮助的人:245万
展开全部
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式