简体   繁体   English

模型1是MVC体系结构的子类别吗?

[英]Is Model 1 a subcategory of the MVC architecture?

A simple question asked many many many many times... 一个简单的问题问了很多很多遍了……

Model 1 and Model 2 Architecture... 模型1和模型2体系结构...

I simple cannot uderstand why Model one is called MVC1... 我简直无法理解为什么将模型一称为MVC1 ...

Cause in the Model 1 we don't have that strong decoupling from Model view and controllor, in Model 1, a request is made to a JSP or servlet and then that JSP or servlet handles all responsibilities for the request... 因为在模型1中,我们在模型视图和控件之间没有那么强的解耦,所以在模型1中,向JSP或Servlet发出请求,然后JSP或Servlet处理该请求的所有责任...

So if the sepration from the controller and the view is not an evidence, why call the Model 1, simply a subcategry of the MVC pattern? 因此,如果与控制器和视图的分离不是证据,那么为什么将模型1称为MVC模式的子类别?

It's just the start of the historical process that brings us to the MVC achitecture.. 这只是将我们带入MVC架构的历史过程的开始。

Is my reasoning right? 我的推理对吗?

This article: 本文:

http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/developing_mvc_applications/adf_aboutmvc2.html http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/developing_mvc_applications/adf_aboutmvc2.html

Seems to agree with me...but i would like to know what you think about... 似乎同意我的看法...但我想知道您的想法...

The Java BluePrints 4.4.1 Structuring the Web Tier specifically warn against this interpretation: Java BluePrints 4.4.1构建Web层特别警告以下解释:

The literature on Web-tier technology in the J2EE platform frequently uses the terms "Model 1" and "Model 2" without explanation. J2EE平台中有关Web层技术的文献经常使用术语“模型1”和“模型2”,而没有进行解释。 This terminology stems from early drafts of the JSP specification, which described two basic usage patterns for JSP pages. 该术语源于JSP规范的早期草案,该草案描述了JSP页面的两种基本用法模式。 While the terms have disappeared from the specification document, they remain in common use. 虽然这些术语已从规范文档中消失,但它们仍然是常用的。 Model 1 and Model 2 simply refer to the absence or presence (respectively) of a controller servlet that dispatches requests from the client tier and selects views. 模型1和模型2分别简单地指代控制器Servlet的不存在或存在,该控制器Servlet调度来自客户端层的请求并选择视图。

Moreover, if we consider that the Model–view–controller (MVC) architectural pattern goal is to divide the application into three interconnected parts ( Model , View and Controller ) and that the Model 1 has no separation between Controller and View , I don't know if Model 1 can be considered a subcategory of the MVC. 此外,如果我们认为模型-视图-控制器(MVC)架构模式的目标是应用程序分为三个相互连接的部分( 模型视图控制器 ),并且模型1控制器视图之间没有分隔,我不会不知道是否可以将模型1视为MVC的子类别。

Model 2 , instead, is usually associated with the Model–view–controller (MVC) paradigm, as it drives a separation between logic and display. 相反, 模型2通常与模型-视图-控制器(MVC)范例相关联,因为它推动了逻辑与显示之间的分离。

If you read MVC wiki - http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller - you will see there is no concept of MVC Model 1 OR MVC1 pattern OR MVC Model 2 OR MVC2, only the concept of the MVC pattern. 如果您阅读MVC Wiki- http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller-您将看到没有MVC模型1或MVC1模式或MVC模型2的概念OR MVC2,仅是MVC模式的概念。

When you develop JSP application. 当您开发JSP应用程序时。 For simple applications, you can use way 1 (Article call Model 1) that JSP page not only contains the display elements to output HTML, but is also responsible for extracting HTTP request parameters, call the business logic (implemented in JavaBeans, if not directly in the JSP), and handle the HTTP session. 对于简单的应用程序,您可以使用方式1(文章调用模型1),即JSP页面不仅包含用于输出HTML的显示元素,而且还负责提取HTTP请求参数,调用业务逻辑(在JavaBeans中实现,如果不直接实现的话) (在JSP中),并处理HTTP会话。 Way 1 is not implement MVC pattern because all in JSP page, no decouping. 方式1不是实现MVC模式,因为所有内容都在JSP页面中,没有消除耦合。

For complex application, you can use way 2 that IMPLEMENT MVC pattern ( Article call MVC - Model 2 - This name has word is MVC because Model 2 implement MVC pattern). 对于复杂的应用程序,您可以使用IMPLEMENT MVC模式的方式2(本文称MVC-Model 2-该名称为MVC,因为Model 2实现了MVC模式)。 Way 2 ( MVC implementation) help us decouping between View and business logic processing (Controller), between view and model. 方法2(MVC实现)帮助我们在视图与业务逻辑处理(控制器)之间,视图与模型之间分离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM