开发者

What is the difference between MVC model 1 and model 2?

I've recently discovered that MVC is supposed to have two different flavors, model one and model two. I'm supposed to give a presentation on MVC1 and I was instructed that "it's not the web based version, that is refered to as MVC2". As the presentations are about design patterns in general, I doubt that this separation is related to Java (I found some info on Sun's site, but it seemed far off) or ASP.

I have a pretty good understanding of what MVC is and I've used several (web) frameworks that enforce it, but this terminology is new to me. How is the web-based version different from other MVC (I'm guessing GUI) implementations? Does it have something to do with the stateless natur开发者_运维技巧e of HTTP?

Thanks,

Alex


It appears that MVC1 (model1) did not have a strong break between the controller and the view where as in MVC2(model2), these concerns were separated.

See if this gives you any more insight: MVC1 and MVC2 discussion

More InformationJust a little more


I Think this is the main difference between MVC1 andMVC2:

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). But for MVC1 did not have a strong break between the controller and the view.


Model 1 Architecture: - Here JSP page will be responsible for all tasks and will be the target of all requests. The tasks may include authentication, data access, data manipulation etc. The architecture is suitable for simple applications.

Disadvantages: – Since the entire business logic is embedded in JSP chunks of java code had to be added to the JSP page. For a web designer, the work will be difficult as they mite face problems with business logic. The code is not reusable.

Model 2 Architecture : – The servlet act as the controller of the application and will be target of every request. They analyze the request and collect data required to generate response to JavaBeans object that act as model of the application. The JSP page forms the view of the application.

Advantages: – Reusability Ease of maintenance.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜