Spring + GWT 或 Spring vs GWT [英] Spring + GWT or Spring vs GWT

查看:24
本文介绍了Spring + GWT 或 Spring vs GWT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GWT、Java 和 EclipseLink 开发 Web 应用程序.这些选择中的每一个都是我为实施该计划所做的选择.GWT 是唯一的选择,因为它与 Spring 之类的东西相比究竟是什么并没有确切的把握.现在我使用 GWT 小部件来实现客户端,使用 GWT RequestFactory 来实现来自 EclipseLink 的实体的服务器-客户端通信.

I am in the middle of developing a web application using GWT, Java, and EclipseLink. Each of those selections are choices I have made to implement this program. GWT is the only choice where there is not a firm grasp as to what it is exactly compared to something like Spring. Right now I use GWT widgets to implement the client and GWT RequestFactory to implement the server-client communication of entities from EclipseLink.

所以我认为 GWT 主要是一个小部件库,具有用于服务器-客户端通信的简单框架.这与我看待 Spring 的方式大致相同,Spring 是一个小部件库,具有用于控制服务器-客户端通信的更高级和复杂的框架 - 可能它不像 GWT 那样方便地实现 AJAX.

So I view GWT as primarily a library of widgets with a simple framework for server-client communication. This is much the same way I view Spring, a library of widgets with a much more advanced and complex framework for controlling server-client communications - with the possibility that it does not implement AJAX as conveniently as GWT does.

考虑到这些,我将 GWT 视为理解并最终使用 Spring 的垫脚石.然而,谷歌再次讨论这个话题,我遇到了几个这样的话题 one 和那个 one 似乎反对Spring 是什么的原始概念,以及它对 GWT 的意义.

So with these in mind, I view GWT as a stepping-stone to understanding and eventually working with Spring. However, Google-ing on this topic again, I've come across several topics like this one and that one that seem to go against the original notions of what Spring is, and what that means for GWT.

  1. 对 GWT 和 Spring 的观点是否存在误解?如果是这样,我们将不胜感激!
  2. Spring 框架中 GWT 小部件的对应部分是什么?
  3. Spring 框架中 GWT RequestFactory 的对应部分是什么?

推荐答案

这实际上取决于您计划如何在应用程序中使用 GWT.

It really depends on how you plan to use GWT in your application.

GWT 最适合用于单个主机页面的 Web 应用程序.
这意味着所有的流同步和业务逻辑都是在客户端使用 GWT 完成的.
这是 GWT 真正闪耀的地方(参见 此处 了解更多详情).

GWT is best used for single host page web-applications.
That means that all the flow synchronization and business logic is done on the client side using GWT.
This is where GWT really shines (see here for more details).

然而,如果你沿着这条路走下去,你最终会得到两个不同的应用程序.例如,您将拥有一个使用 GWT 开发的前端和一个使用 Spring 开发的后端.您的后端(Spring 或您使用的任何东西)只会充当数据存储",为您提供要在 GWT 前端显示的数据.因此,您可能不会使用任何 Spring MVC's 功能.

However if you go down this road, you will end up with basically two distinct applications. You will have a frontend developed with GWT and a backend using Spring for example. Your backend (Spring or whatever you use) will only act as a "data storage" providing you with data that you are going to display in your GWT frontend. So your will probably not using any of the Spring MVC's functionality.

当然,您也可以使用 Spring MVC 并仅使用 GWT 将 Web 2.0ish 功能添加到您的网站,但对于该用例,我建议您宁可使用 jQuery、Closure 或其他 javascript 框架.

Of course you can also use Spring MVC and use GWT only to add web 2.0ish functionality to your site, but for that use case I would recommend to rather use jQuery, Closure or other javascript frameworks.

对于您的问题:

对 GWT 和 Spring 的观点是否存在误解?如果是这样,一些关于此的简要指导点将不胜感激!

Is there a misconception about the views on GWT and Spring? If so, some brief guiding points about that would be much appreciated!

如果您按预期使用 GWT(单个主机页面 Web 应用程序),那么您将不会使用 Spring 的 MVC 部分.您仍然可以使用 授权身份验证ORM 和 Spring 框架的许多其他组件,但是 GWT 会处理所有视图.
Spring 或多或少仅作为 GWT 前端应用程序的数据存储.这就像拥有两个不同且独立的应用程序,它们通过通信协议(RequestFactoryRESTRPC 等)连接起来.

If you use GWT as it is intended (single host page web-applications) then you won't use the MVC part of Spring. You can still use authorization, authentication, ORM and many other components of the Spring framework, however GWT handles all the views.
Spring acts more or less only as a data storage for your GWT frontend app. It's like having two distinct and separate apps that are connected through a communication protocol (RequestFactory, REST, RPC, etc).

Spring 框架中 GWT 小部件的对应部分是什么?

What would be the counter-part to GWT widgets in the Spring Framework?

Spring 框架中没有真正的 GWT 小部件的对应部分(可能是某些扩展 JSF).Spring 是关于服务器端的,所以那里的所有视图都是在服务器端创建的.而 GWT 是关于客户端的.

There is no real counter-part to GWT widgets in the Spring Framework (maybe to some extends JSF). Spring is all about the server-side so all the views there are created on the server side. Whereas GWT is all about client side.

Spring 中 GWT RequestFactory 的对应部分是什么框架

What would be the counter-part to GWT RequestFactory in the Spring Framework

RequestFactory 是前端应用 (GWT) 和后端应用 (Spring) 之间的通信协议.当您使用 Spring MVC 时,您不需要任何通信协议,因为视图是在您已经拥有数据的服务器端生成的.

RequestFactory is the communication protocol between your frontend app (GWT) and your backend app (Spring). When you use Spring MVC you don't need any communication protocol as the views are generated on the server side where you already have the data.

这篇关于Spring + GWT 或 Spring vs GWT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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