从 HTML/JS 迁移到 GWT
我有使用 Java、HTML、JS 和 CSS 开发 Web 应用程序的经验。此时我想学习/尝试 GWT,但在此之前我希望澄清以下问题:
- 与传统的 HTML/CSS/JS 开发相比,GWT 耗时多少?
- GWT 设计人员是否友好,即设计(布局)和/或样式是否可以在 Java 之外通过 XML、HTML 等完成?
- 与直接的 JS/CSS 相比,定制 GWT 小部件/组件的外观有多困难?
- 创建自定义小部件/组件有多困难?
- GWT 传统上是否与后端 Web 服务一起使用?
谢谢。
I have experience developing web applications using Java, HTML, JS, and CSS. At this point I want to learn/try out GWT, but before I do so I'd appreciate clarification on the following:
- Compared to traditional HTML/CSS/JS development how much more time consuming is GWT?
- Is GWT designer friendly, i.e. can the design (layout) and/or styling be done outside of Java via XML, HTML, etc.?
- Compared to straight JS/CSS how difficult is it to customize the look and feel of GWT widgets/components?
- How difficult is it to create custom widgets/components?
- Is GWT traditionally used with back-end web services?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
1)很多,如果你的模块增长得相当大,仅仅简单地刷新你的前端(或在部署之前编译)可能会非常耗时。不过,您可以像往常一样使用 Firebug 或类似的工具,更有趣的是,调试既简单又强大。然而,存在一些小问题,例如基于 Java 和 Javascript 的正则表达式之间不兼容。
2) 更困难的是,例如,获取由基于 Photoshop 等的设计师提供的“预期屏幕样本”(不确定如何称呼)并将其转换为基于 html/js GWT 的前端。这是一个真正的缺点。
3)你需要知道你在做什么。但确实有很多现成的东西。使用 GXT/SmartGWT 或类似的库会有所帮助。将 JQuery 内容与所有这些插件一起包含在前端也很困难。
4) 这才是 GWT 真正强大的原因。后端的东西以及前端与之通信的便利性。我的观点是,如果您需要大量业务(主要是后端)逻辑,一旦您学会了如何在开发中有效地使用 GWT,您就不会后悔使用它。与 BE 部分的通信也使得在客户端编写业务逻辑变得更加容易。如果您渴望前端有漂亮的、非标准的、易于定制的东西,没有太多的逻辑,没有太多复杂的数据传输等,那么您最好使用“标准”非 GWT 方法。对于许多使用 GWT 的人来说,一大优势是他们不需要用 JS 编写代码,而且 GWT 生成的 JS 代码快速、有效且跨浏览器。如果您不介意用 html/js 编写前端(并且不会错过适当的调试控制)并且希望使用 Java、DWR 或其他一些轻量级 Ajax 库编写 BE,那么您可能会感兴趣。
1) a lot, just simple refreshing of your front-end (or compiling before deploy) may be pretty time consuming if your module grows in considerable size. You may however use Firebug or similar tools as usual, and what is much more interesting, the debugging is easy and powerful. There are however small issues, like incompatibility between Java and Javascript based regular expressions.
2) it is more difficult to e.g. take an 'intended screen sample' (not sure how this is called) provided by your Photoshop etc. based designer and convert it to html/js GWT based front-end. This is a real drawback.
3) you need to know what you are doing. but there is really a lot readily available. Using GXT/SmartGWT or similar libraries helps. It is also difficult to include JQuery stuff with all those plugins at your front-end.
4) This is what really makes GWT powerful. back-end stuff and the ease of communication with it from front-end. My view is, that if you need a lot of business (mostly back-end) logic you won't regret using GWT once you learn how to use it effectively in your development. The communication with BE part makes it also much easier to write business logic at clients too. If you crave beautiful, non-standard, easily customizable stuff in front-end with not that much logic, not much complex data transfered etc, you are better off with 'standard' non-GWT approach. One major advantage for many guys working with GWT is that they do not need to write code in JS and the JS code generated by GWT is fast, effective and cross-browser. If you do not mind writing your front-end in html/js (and do not miss proper debugging control) and you want to write BE using Java, DWR or some other light-weight Ajax library might interesting for you.
GWT 旨在提高可扩展性和可管理性,这当然会带来成本。如果您习惯于在小型团队(即 1-5 人)的小型网站/应用程序上直接使用 HTML/CSS/JS 工作,那么 GWT 可能会增加比其价值更多的复杂性。
如果您处于更大规模的环境中,并且期望进行多次迭代并且不同的人进出项目,那么可能值得使用框架 - 而且 GWT 非常好。当您正在使用时,请查看 GWT EXT JS :)
与直接使用 HTML 相比,自定义 GWT 很困难(但如果将来发生重大更改,则会有所回报)。为了了解所有组件如何组合在一起,需要了解很多有关 GWT API 和架构的知识。
GWT is intended to be more scalable and manageable, and that of course comes with its costs. If you are used to working DIRECTLY in HTML / CSS / JS on smaller sites / apps with small teams (i.e. 1-5 people), GWT might add more complexity than it's worth.
If you're in a larger scale environment and expect many iterations and different people moving in / off the project, it is probably worth using a framework - and GWT is pretty good. Check out GWT EXT JS while you're at it :)
Compared to working directly with HTML, customizing GWT is HARD (yet rewarding if major changes ever come down the road). There is a lot to learn about the GWT API and architecture, in order to understand how all of the components fit together.
当然,在 GWT 中实现定制更加困难。你必须考虑到你正在用 Java 编写代码,这些代码将被翻译成 js。
当然,您可以与不同的 js 库集成,但仍然比普通的旧 html/css/js 更难。
还要考虑这样一个事实:如果您要做一些 SEO,GWT 可能会很棘手。
For sure is harder to implement customizations in GWT. You have to consider that you are wrinting code in Java that will be translated in js.
Of course you have the possibility to integrate with different js libraries, but still harder than plain old html/css/js.
Consider also the fact the if you are going to do some SEO, GWT could be tricky.