Biggest GWT Pitfalls? [closed]

2019-01-12 13:06发布

I'm at the beginning/middle of a project that we chose to implement using GWT. Has anyone encountered any major pitfalls in using GWT (and GWT-EXT) that were unable to be overcome? How about from a performance perspective?

A couple things that we've seen/heard already include:

  • Google not being able to index content
  • CSS and styling in general seems to be a bit flaky

Looking for any additional feedback on these items as well. Thanks!

24条回答
可以哭但决不认输i
2楼-- · 2019-01-12 13:53

GWT 2.0, which is supposed to come out sometime in the next few months, solves a lot of the issues discussed.

  • Create layouts using an html/xml like syntax
  • Dynamic Script Loading - only the essential JS will be downloaded initially. The rest will be downloaded as needed
  • In-Browser Hosted Mode - This might take care of the hosted mode speed issues discussed, among other benefits
  • "Compiler Optimizations" - Faster compilation, hopefully

GWT 2.0 Preview Video at Google I/O

查看更多
贪生不怕死
3楼-- · 2019-01-12 13:53

No major pitfalls that I haven't been able to overcome easily. Use hosted mode heavily. As you are using GWT-ext you will almost never need to touch CSS yourself unless you want to tweak the out of the box look.

My recommendation is to use a GWT "native" widget over a library one where they are close in features.

Re search engine indexing: yes the site will not have navigable URLs normally (unless you are only adding widgets to elements of a regular web site). You can do history back/forward functionality though.

查看更多
祖国的老花朵
4楼-- · 2019-01-12 13:53

The GWT team make a lot of great improvements in to last year releasing GWT 2.7. One major weakness of GWT was that compilation takes to much time in GWT 2.6 and below. This is now gone GWT has not incremental compile which is super fast and compiles only the changes.

GWT 2.7 now has (Source):

  • Incremental builds now just seconds
  • More compact, more accurate SourceMaps
  • GSS support
  • JSInterop
  • Great JavaScript Performance
  • Smaller Code Size
查看更多
不美不萌又怎样
5楼-- · 2019-01-12 13:54

Not "unable to be overcome" but a bit of a pain for something basic.

Date handling:

GWT uses the deprecated java.util.Date which can lead to unexpected behaviour when dealing with dates on the client side. java.util.Calendar is not supported by GWT. More info here.

Related problem examples:

查看更多
劫难
6楼-- · 2019-01-12 13:55

I second the comment from ykagano, the biggest disadvantage is losing the V in MVC. Although you can separate the true ui class from the rest of your client side code, you cannot easily use an HTML page generated by a graphic/web designer. This means you need a developer to translate HTML into java.

Get a wysiwyg ui editor, it will save you lots of time. I use GWTDesigner.

The biggest upside of GWT is being able to forget about cross browser issues. Its not 100% but takes almost all that pain away. Combined with the benefit of hosted mode debugging (as opposed to Firebug which is excellent but not the same as a java debugger) it gives the developer a huge advantage in generating complex ajax apps.

Oh and its fast at runtime, especially if you use a gzip filter.

查看更多
▲ chillily
7楼-- · 2019-01-12 13:55

One major pitfall is that sometimes you need to explicitly assign an id to what ultimately becomes an HTML element to be able to use certain CSS styles. For instance: a GWT TabPanel will only do :hover over tabBarItems when the tabBar of the tabPanel has been assigned an id and you specify a :hover on that elementId.

I wrote about some other disadvantages of GWT elsewhere, but they are already covered by rustyshelfs answer :).

查看更多
登录 后发表回答