早教吧 育儿知识 作业答案 考试题库 百科 知识分享

急求英文翻译1.Aviewdisplaystheinformationcontainedinamodel,takingentireresponsibilityformarkuporothercontentgeneration.Aviewneedn'tknowanythingabouttheimplementationofthecontrollerortheunderlyingbusinessobject

题目详情
急求英文翻译 1. A view displays the information contained in a model, taking entire responsibility for markup or other content generation. A view needn't know anything about the implementation of the controller or the underlying business objects.
2. JSP is the most used view technology for J2EE applications, although, as we'll see in the next chapter, there are several valid alternatives. We've noted that JSP gives us the power to do things that are inappropriate in views. The following guidelines indicate what operations are appropriate in views:
3. A view should be wholly responsible for generating web content, given data models.
4. A view should not work directly with request parameters. A controller should intercept incoming requests, and provide the view with models.
5. A view should not perform data retrieval (for example, by running SQL queries). The view should merely display data, which will be exposed by one or more models. The Dispatcher View J2EE Pattern (Core J2EE Patterns) in which a JSP view retrieves data using a helper as it renders, is fundamentally broken, as it is vulnerable to unexpected errors during rendering. Core J2EE Patterns terms the controller-managed data retrieval described here the Service-to-Worker pattern. (No, I don't understand how they thought up these names, either.)
6. A view may need to perform display logic, as distinct from control logic or business logic. Examples of display logic include displaying the rows of a table in alternate colors, or displaying additional information on a generated page if the model contains optional data. Such logic does not belong in controllers, as it's unique to a particular presentation.
7. A view should not have to deal with data-retrieval failures. In practice, this means that properties and methods exposed by models should not throw exceptions; data retrieval should be complete before a view begins to render
▼优质解答
答案和解析
作为控制器的核心是在MVC的Web应用程式,让我们考虑控制器第一.