基于组件的MVC框架和基于动作的MVC框架

发布于 2024-12-29 05:10:55 字数 131 浏览 2 评论 0原文

您好,我曾使用过 JSF,它是一个基于组件的 MVC 框架。我知道很多 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水中月 2025-01-05 05:10:56

基于组件的 Web 框架是一种实现基于 Web (HTTP) 的应用程序的方法,类似于厚客户端应用程序,其中用户在 GUI 控件上进行操作,这些控件会因事件而触发操作。这里视图(网页)是应用程序的核心部分。

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

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

ps Java Web 应用程序从 MVC 到基于组件的框架,或者更确切地说,首先是 Struts 等,然后是 JSF。在 .NET 世界中,首先出现了 ASP.NET,然后出现了 ASP.NET MVC。

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.

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.

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 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文