简体   繁体   English

从HTML / JS迁移到GWT

[英]Moving from HTML/JS to GWT

I have experience developing web applications using Java, HTML, JS, and CSS. 我有使用Java,HTML,JS和CSS开发Web应用程序的经验。 At this point I want to learn/try out GWT, but before I do so I'd appreciate clarification on the following: 在这一点上,我想学习/尝试GWT,但在此之前,我希望澄清以下内容:

  1. Compared to traditional HTML/CSS/JS development how much more time consuming is GWT? 与传统的HTML / CSS / JS开发相比,GWT需要多长时间?
  2. Is GWT designer friendly, ie can the design (layout) and/or styling be done outside of Java via XML, HTML, etc.? GWT设计师是否友好,即设计(布局)和/或样式是否可以通过XML,HTML等在Java之外完成?
  3. Compared to straight JS/CSS how difficult is it to customize the look and feel of GWT widgets/components? 与直接JS / CSS相比,定制GWT小部件/组件的外观和感觉有多难?
  4. How difficult is it to create custom widgets/components? 创建自定义小部件/组件有多难?
  5. Is GWT traditionally used with back-end web services? GWT传统上是与后端Web服务一起使用的吗?

Thanks. 谢谢。

GWT is intended to be more scalable and manageable, and that of course comes with its costs. GWT旨在提高可扩展性和可管理性,当然还有成本。 If you are used to working DIRECTLY in HTML / CSS / JS on smaller sites / apps with small teams (ie 1-5 people), GWT might add more complexity than it's worth. 如果您习惯在小型团队(即1-5人)的小型网站/应用程序中直接在HTML / CSS / JS中工作,那么GWT可能会增加复杂性而不是它的价值。

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. 如果你处于一个更大规模的环境中并期望许多迭代和不同的人进入/离开项目,那么使用框架可能是值得的 - 而且GWT非常好。 Check out GWT EXT JS while you're at it :) 当你在它的时候看看GW​​T EXT JS :)

Compared to working directly with HTML, customizing GWT is HARD (yet rewarding if major changes ever come down the road). 与直接使用HTML相比,定制GWT是很难的(如果有重大变化,那么就会有所回报)。 There is a lot to learn about the GWT API and architecture, in order to understand how all of the components fit together. 有关GWT API和架构的知识有很多,以便了解所有组件如何组合在一起。

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. 1)很多,如果您的模块增长相当大,只需简单地刷新前端(或在部署之前进行编译)可能非常耗时。 You may however use Firebug or similar tools as usual, and what is much more interesting, the debugging is easy and powerful. 但是,您可以像往常一样使用Firebug或类似工具,更有趣的是,调试简单而强大。 There are however small issues, like incompatibility between Java and Javascript based regular expressions. 然而,存在一些小问题,例如Java和基于Javascript的正则表达式之间的不兼容性。

2) it is more difficult to eg 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. 2)更难以例如采用基于Photoshop等设计者提供的“预期屏幕样本”(不确定如何调用)并将其转换为基于html / js GWT的前端。 This is a real drawback. 这是一个真正的缺点。

3) you need to know what you are doing. 3)你需要知道你在做什么。 but there is really a lot readily available. 但实际上有很多可用的。 Using GXT/SmartGWT or similar libraries helps. 使用GXT / SmartGWT或类似的库有帮助。 It is also difficult to include JQuery stuff with all those plugins at your front-end. 在前端包含所有这些插件的JQuery内容也很困难。

4) This is what really makes GWT powerful. 4)这真正使GWT变得强大。 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. 我的观点是,如果您需要大量业务(主要是后端)逻辑,一旦您学习如何在开发中有效地使用GWT,您就不会后悔使用GWT。 The communication with BE part makes it also much easier to write business logic at clients too. 与BE部分的通信使得在客户端编写业务逻辑也变得更加容易。 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. 如果你渴望美丽的,非标准的,易于定制的前端,没有太多的逻辑,没有太多复杂的数据转移等,你最好采用“标准”的非GWT方法。 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. 使用GWT的许多人的一个主要优点是他们不需要在JS中编写代码,而GWT生成的JS代码是快速,有效和跨浏览器的。 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. 如果您不介意在html / js中编写前端(并且不要错过正确的调试控制),并且您希望使用Java编写BE,那么DWR或其他一些轻量级Ajax库可能会让您感兴趣。

For sure is harder to implement customizations in GWT. 当然,在GWT中实现自定义更难。 You have to consider that you are wrinting code in Java that will be translated in js. 您必须考虑使用Java编写将在js中翻译的代码。

Of course you have the possibility to integrate with different js libraries, but still harder than plain old html/css/js. 当然你有可能与不同的js库集成,但仍然比普通的旧html / css / js更难。

Consider also the fact the if you are going to do some SEO, GWT could be tricky. 还要考虑一下如果你要做一些SEO,GWT可能会很棘手。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM