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

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

问题描述

背景



我正在使用GWT,Java和EclipseLink开发Web应用程序。这些选择中的每一个都是我为实现此计划而做出的选择。 GWT是唯一的选择,如果没有确切地把握它与Spring之类的东西相比的话。现在,我使用GWT小部件来实现客户端和GWT RequestFactory,以实现来自EclipseLink的实体的服务器 - 客户端通信。
$ b

视图



因此,我将GWT视为主要的一个小部件库,它具有一个简单的服务器 - 客户端通信框架。这与我看待Spring的方式非常相似,Spring是一个具有更先进和更复杂的框架来控制服务器 - 客户端通信的小部件库,它可能不像GWT那样方便地实现AJAX。



因此,考虑到这些,我认为GWT是理解并最终与Spring合作的踏脚石。但是,Google再次讨论这个话题,我遇到过几个话题,比如一个,而且似乎违背了一个 Spring的原始概念,以及GWT的含义。

问题




  1. 对GWT和Spring的看法有误解吗?如果是这样,一些简要的指导意见将非常感谢!

  2. Spring框架中的GWT窗口小部件的反作用是什么?

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


解决方案

它真的取决于你打算如何在应用程序中使用 GWT

GWT 最适用于单个主机页面的Web应用程序。

这意味着所有流程同步和业务逻辑都是在客户端使用 GWT 完成的。

这就是 GWT 确实闪耀(请参阅这里了解更多详情)。

然而,如果你顺着这条道路走下去,你最终会得到两个截然不同的应用程序。
您将使用 GWT 开发前端,并使用Spring作为后端。
您的后端(Spring或任何您使用的)将仅充当数据存储,为您提供要在GWT前端中显示的数据。
所以你可能不会使用任何 Spring MVC的功能。

当然,您也可以使用 Spring MVC ,并仅使用GWT将Web 2.0ish功能添加到您的站点,但对于这种用例,我会推荐使用jQuery,Closure或其他JavaScript框架。



您的问题:


对GWT的观点存在误解和春天?如果是这样,
一些简要的指导意见将非常感谢!


如果您使用 GWT 按照它的意图(单个主机页面web应用程序),那么你将不会使用Spring的MVC部分。您仍然可以使用授权身份验证 ORM 和Spring框架的许多其他组件,但是GWT处理所有视图。 b $ b Spring或多或少只会作为GWT前端应用程序的数据存储。
就像有两个通过通信协议( RequestFactory REST )连接的独立和独立的应用程序, RPC 等)。



在Spring框架中,GWT窗口小部件的反作用是什么?


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


在Spring
框架中,GWT RequestFactory的对立部分是什么?

blockquote>
$ b

RequestFactory 是您的前端应用程序( GWT )与您的后端应用程序<强>弹簧)。
当您使用 Spring MVC 时,您不需要任何通信协议,因为视图是在已经拥有数据的服务器端生成的。

Background

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.

Views

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.

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.

The Questions

  1. Is there a misconception about the views on GWT and Spring? If so, some brief guiding points about that would be much appreciated!
  2. What would be the counter-part to GWT widgets in the Spring Framework?
  3. What would be the counter-part to GWT RequestFactory in the Spring Framework?

解决方案

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

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

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.

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.

To your questions:

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

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

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

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.

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

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与GWT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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