将 spring 3 mvc 与 GWT 集成的经验? [英] Experiences with integrating spring 3 mvc with GWT?

查看:44
本文介绍了将 spring 3 mvc 与 GWT 集成的经验?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定:Spring 3.0 mvc 具有出色的 REST 支持,其中一种表示是 JSON.

Given: Spring 3.0 mvc has excellent REST support with one of the representation being JSON.

GWT 简化了开发,因为 UI 是用 Java 开发的.但默认情况下,它使用 RPC 进行客户端服务器交互.但是可以选择使用 JSON.

GWT simplifies development as UI is developed in java. But by default it uses RPC for client server interaction. But there is an option to use JSON.

问题:

  1. 你能分享一下在 GWT 中使用 Spring 3.0 mvc 的经验吗?

  1. Can you share experiences with using Spring 3.0 mvc with GWT ?

集成这两个框架的最佳方法是什么?

What is the best approach to integrate these two frameworks?

默认 GWT 的 MVP 架构是否仅适用于客户端?它是否与 JSON 配合良好?

Is the default GWT's MVP architecture only for client side and does it work well with JSON?

谢谢

推荐答案

你能分享一下使用 Spring 3.0 mvc 和 GWT 的经验吗?

是的.我们已经成功地围绕 GWT 和 Spring MVC 构建了一个完整的大型应用程序(1500 个源文件,开发时间为 6 个月).

Yes. We've successfully built a whole large application around GWT and Spring MVC (1500 source files, 6 months in development).

Spring 是项目成功的关键.只有使用 Spring,我们才能在服务器端单独测试应用程序的某些部分.

Spring was the key to the project's success. Only with Spring we were able to test individually some pieces of the application on the server side.

结合这两个框架的最佳方法是什么?

忽略 GWT 使用的默认 Servlet,而是创建您自己的 Spring 控制器来处理传入的 GWT-RPC 请求.这篇博文是整合这两种技术的关键.

Ignore the default Servlet used by GWT and instead create your own Spring controller to handle incoming GWT-RPC requests. This blog post was the key to integrating the two techs.

我们还成功地集成了其他组件:用于动画图表的 Flash 和用于其他内容的第三方 Javascript 组件.它们通过 JSON 与服务器通信.所以你有两种或多种网址:

We also successfully integrated other components: Flash for animated charts and third-party Javascript components for other stuff. These communicate with the server through JSON. So you have two or more kinds of URLs:

  • *.rpc url 用于 GWT 组件,由 Spring 控制器为 gwt 提供服务
  • *.json url 用于其他组件,并由另一个 Spring 控制器提供服务.
  • the *.rpc urls are for GWT components and are served by the Spring controller for gwt
  • the *.json urls are for other components and are served by another Spring controller.

此外,在我们的例子中,我们避开了带有注释的配置,而是使用旧的 Spring XML 文件进行首选配置.他们更清楚发生了什么.@Required 注解除外;找到应该连接但没有连接的春豆真是太好了.

Also, in our case, we shunned configuration with annotations and instead preferred configuration with the good old Spring XML files. They make it much more clear what's going on. Except for the @Required annotation; it's great to find spring beans that should be connected but aren't.

默认的 GWT 的 MVP 架构是否仅用于客户端,它是否适用于 JSON?

如果您遵循指南,GWT 的 MVP 架构将发挥最佳效果.按照 Google 的建议使用 GWT-RPC 通信.

GWT's MVP architecture works best if you follow the guide lines. Use GWT-RPC communication as Google suggests.

您仍然可以为其他客户端组件使用 JSON.

You can still have JSON for other client-side components.

这篇关于将 spring 3 mvc 与 GWT 集成的经验?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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