基于组件的MVC框架和基于操作的MVC框架 [英] Component base MVC framework and action based MVC framework

查看:91
本文介绍了基于组件的MVC框架和基于操作的MVC框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我曾经使用过基于组件的MVC框架JSF.我知道很多Web项目使用Spring作为其技术,Spring属于基于动作的UI框架"类别.我想知道这里有什么区别?哪一个更高级,并给用户带来更大的灵活性?一些利弊?

Hi I have worked with JSF which is a component based MVC framework . I know a lot of web projects use Spring as their technology and Spring falls under the category "action based UI framework " . I want to know what is the difference here ? Which one is more advanced and gives more flexibility to the users ? Some pros and cons ?

推荐答案

基于组件的Web框架是一种实现基于Web(HTTP)的应用程序的方式,类似于用户在GUI上操作的 thick-client 应用程序控制由于事件而触发的火灾动作.视图(网页)是应用程序的核心部分.

Component Based Web Framework is a way of implementing Web (HTTP) based applications similar to thick-client applications where user operates on GUI controls which fire actions as a result of events. Here views (web pages) are central piece of the application.

基于动作的Web框架强调HTTP协议的请求-响应性质,其中请求表示要执行的动作(通常:请求URI映射到操作,请求参数/主体映射到操作参数).这里的视图只是呈现操作/动作结果的一种方式.

Action Based Web Framework puts emphasis on request-response nature of HTTP protocol, where requests represent actions to be performed (in general: request URI maps to operation, request parameters/body maps to operation arguments). Here views are just a way of rendering the results of operations/actions.

两个模型都有优点和缺点.前者似乎更容易(特别是如果有Swing背景的人),但从长远来看,HTTP的req-res本质是通过程序员来实现的.后者更自然地适合HTTP,并允许编写更多可测试的代码(控制器).

Both models have pros and cons. The former seems easier (especially if one has Swing background) but in the long term the req-res nature of HTTP comes in the way of programmer. The latter is more natural fit to HTTP and allows to write more testable code (controllers).

p.s. Java Web应用程序从MVC转到基于组件的框架,或者首先是Struts等人,然后是JSF.在.NET世界中,首先是ASP.NET,然后是ASP.NET MVC.

p.s. Java web apps went from MVC to Component based frameworks, or rather first there were Struts et al, and then JSF. In .NET world first there was ASP.NET and then ASP.NET MVC.

这篇关于基于组件的MVC框架和基于操作的MVC框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆