开发者

what is the difference between MVC1 and MVC2

I am using MVC design pattern in jsp-servlet web application, and want to what is the exact difference between MVC1 and MVC2 , can someone help?

EDIT newly I hear that there is 2 versions of using MVC in servlet programming, I hear that in MVC1 there is kind of coupling between controller and view , but in MVC2 they overtake it, if 开发者_如何学Gosomeone know whether this is right or wrong I'll be very thankful.


It might be possible that you read this version in connection with asp.net MVC, as there different versions of that framework. There is no version 2.0 of the mvc pattern, just a version 2.0 of the asp.net MVC framework.

In context of jsp servlets see: Model 1 and Model 2. In a nutshell: Model 1 doesn't have a controller to dispatch requests, Model 2 does.


In MVC 1, controller and model,both are JSP. While in MVC2 controller is servlet and model is java class. In MVC1 there is tight coupling between page and model as data access is usually done using Custom tag or through java bean call.
In MVC2 architecture there is only one controller which receives all the request for the application and is responsible for taking appropriate action in response to each request.


MVC1 was a first generation approach that used JSP pages and the JavaBeans component architecture to implement the MVC architecture for the Web. HTTP requests are sent to a JSP page that implements Controller logic and calls out to the Model for data to update the View. This approach combines Controller and View functionality within a JSP page and therefore breaks the MVC paradigm. MVC1 is appropriate for simple development and prototyping. It is not, however, recommended for serious development.

MVC2 is a term invented by Sun to describe an MVC architecture for Web-based applications in which HTTP requests are passed from the client to a Controller servlet which updates the Model and then invokes the appropriate View renderer-for example, JSP technology, which in turn renders the View from the updated Model. The hallmark of the MVC2 approach is the separation of Controller code from content. (Implementations of presentation frameworks such as Struts, adhere to the MVC2 approach).

That's what I found here: http://www.theserverside.com/discussions/thread.tss?thread_id=20685


MVC-1 Architecture

1) In MVC-1 Architecture, single web component(Servlet/JSP) is used as Controller and view but for other layers separate web components are taken.... 2) Since, single component is taken as Controller and view, logics are mixed up..

MVC-2 Architecture

1) In MVC-2 Architecture separate components should be taken for separate layers... 2) Logics are not mixed, there is clean separation between the logics....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜