views:

3577

answers:

6

I'm a long time Java developer who has been building UI with Adobe Flex for the past few years. I'm looking to broaden my repertoire with a RIA technology that runs in a plain-old browser, no plug-ins required. I've read a lot about GWT but don't know much about JSF, especially given the varying implementations. Below are some criteria that are important to me as a developer. I'm hoping that the community might be able to tell me about the strengths and weaknesses of GWT and JSF in each:

  • Layout: is it declarative, programmatic or a mix of both?
  • Control library: how rich is the available control library? How easy is it to extend or write custom controls that "play nice" with the built-ins?
  • Javascript: how much of it do I need to write in order to be successful with the framework?
  • Cross-browser: assuming I'm not writing a lot of my own HTML and JS, do the frameworks function equally well in all modern browsers?
  • Tooling: is a rapid edit/refresh cycle available? How easy is it to debug the client and server code?
  • Bookmarking / Browser Navigation: this is a common problem in Flex; does the framework play nicely with these?

I would love to hear any other important pros / cons I might not have covered. Thanks!

+8  A: 

i've only touched JSF for a little while, and i didnt like it, so my answer will be slightly biased, but:

Layout: GWT layout is programmatic (i.e., not declarative. But stay tuned for GWT1.7, it might become declarative). GWT layout is done using things like layout managers, panels etc (if you have seen swing programming, it will look similar). JSF is declarative as far as i know.

Control library: JSF has rich controls, but it is difficult to customize them to any extend without writing a lot of code. GWT has many basic controls, and a simple framework to compose them. I personally find that GWT allows finer grain customization.

Javascript: JSF, no js required, unless you are writing your own control(which means tonnes of js?). GWT no js requred, unless you are integrating external js library. then you have some js to write by the way of JSNI (javascript native interface).

Cross-browser: as far as i can tell both GWT and JSF seems to be pretty cross-browser....but just because i ve never seen any hitches so far, doesnt mean they both dont have their issues.

Tooling: For JSF, i used oracle's JDeveloper, and the debugging/stepping through code part is quite nice, though JDeveloper is slow as hell. It does have a wysiwyg GUI editor, but when i used it, it kinda sucked. GWT has the google eclipse plugin, which integrates well. But so far, no decent GUI editor for GWT afaict. GWT designer is one, but its not free. Intellij IDEA is another great IDE for GWT.

Bookmarking / Browser Navigation: GWT has a history management component which you then roll a bookmarking component, and its pretty standard (http://developerlife.com/tutorials/?p=232 ). Not sure about jsf, never got that far.

Chii
+5  A: 

I've only glanced at the GWT docs, so can't compare the technologies. I know next to nothing about Flex. I'll spill what I know about JSF, though, so hopefully you can make up your own mind. I know there was an effort to integrate GWT and JSF (G4JSF), but don't think it went anywhere.

JSF2 is on the cusp of release. David Geary is writing a series of devWorks articles on the new features.

  • Layout: is it declarative, programmatic or a mix of both?

Generally declarative. There are two common view technologies: JSP and Facelets. The JSF component tree approach to UI can be at odds with the inherent nature of JSPs, so prefer Facelets. Facelets are standardised in JSF2 and thus will become part of JEE6.

It is possible, but non-trivial, to use a purely programmatic view.

Most JSF tags provide a binding attribute which can be used to provide an alternative component at view creation time, but I wouldn't recommend using it without a detailed understanding of the JSF framework. Programmatic composite example on the MyFaces wiki.

  • Control library: how rich is the available control library? How easy is it to extend or write custom controls that "play nice" with the built-ins?

The standard library is very basic. This is what you get with a JSF implementation (e.g. Mojarra; MyFaces).

Beyond this, you can drop in libraries onto your classpath to provide new or alternative controls. As of JSF 1.2, this is the primary method by which you gain AJAX-enabled controls. There are a number of open source/commercial libraries out there and proprietary IDEs generally provide more. I believe many of these libraries take their own approach to AJAX implementation, so would be surprised if they mixed well. jsfmatrix.net tries to maintain a list of libraries and their features.

Writing a JSF control is a fiddly process with many manual steps. Writing a sophisticated control that supports children (like a datagrid) can get quite complex and requires a detailed knowledge of the JSF framework.

It is possible to create composite controls from existing controls and this is considerably easier than writing a control from scratch.

Trying to integrate existing JavaScript libraries can be difficult. A particular sticking point can be in how JSF handles HTML ids. Adding your own AJAX support can be non-trivial due to the way the JSF lifecycle works and how controls decode their own input values from the request.

In JSF2, AJAX support is standardised in the framework. Jim Driscoll wrote a blog post last November about how to write an in-place editable text field (the API might have changed since, though). There are a few other tweaks that should help with AJAX integration.

  • Javascript: how much of it do I need to write in order to be successful with the framework?

None, so long as the set of controls you use does everything you want. See above.

  • Cross-browser: assuming I'm not writing a lot of my own HTML and JS, do the frameworks function equally well in all modern browsers?

This will depend on the widget libraries you choose. There is some JS in the base implementations - expect it to be browser agnostic.

  • Tooling: is a rapid edit/refresh cycle available? How easy is it to debug the client and server code?

I debug on a web server, so performance depends on how heavyweight the container is. The Eclipse tools tend to autodeploy-on-save to a running container; NetBeans uses a run button to do the same (these may not be the only options - I haven't had cause to go looking). The experience is adequate but not exceptional.

I've seen JSP WYSIWYG editors in both Eclipse and NetBeans (though I think the latter is for the Visual JSF/Project Rave/Woodstock library). I don't know about Facelet editors - I haven't gone looking. I did notice this: Jim Driscoll's comments on the state of JSF2 tooling.

  • Bookmarking / Browser Navigation: this is a common problem in Flex; does the framework play nicely with these?

There is nothing inherent in JSF that stops you from bookmarking a page, though it does tend to be a HTTP POST-based framework. It relies on (usually *.faces or /faces/*) servlet mappings to serve the views, so URLs tend not to be friendly (though there are things you can do about that).

McDowell
+1  A: 

First off you are already using a great, popular and in-demand RIA product in Flex. To expand your skills in RIA I would definitely go with GWT over JSF. Especially for the dabbler GWT is very easy to pick-up and has a lot of great widget toolkits such as Ext-GWT, SmartGWT, etc.

Mike C.
+1  A: 

Layout: Winner GWT (Declarative layout much like HTML instead of JSF tags) Control library:Winner GWT (Lot of free widgets) Cross-browser: Winner GWT (If you need to customize JSF than you are down the drains with JSF) Tooling: Winner GWT (Eclipse plugin let you remote debug) Bookmarking / Browser Navigation: Winner GWT (JSF do not even support Bookmarking)

daud
You still remember JSF as it was when 0.1 was released almost a decade ago? That's nice.
BalusC
A: 

Valid opinion regarding that:

GWT is mistake. Huge mistake. Do not be bought by Google name. It's very uncomfortable thing!!!

http://javafuck.wordpress.com/2010/07/28/gwt-is-abbreviation-for-greedy-and-wasteful-technology/

Peter
http://www.youtube.com/watch?v=QsogswrH6ck
Jason Hall
it's opinion after year of work with both JSF and GWT.And before that 10 years java with all possible profiles.It's based (GWT) on weаk argument - Javascript - and not a part of solution, that resolves all layers. I know what I mean when I tell - it's bad.
Peter
A: 

I worked with JSF and GWT for about a year, I had HUGE involvement in both, JSF in primitive form is bad, but GWT in it's best form is much worse. GWT is for hard core programmers, if you have money for them - go ahead. PLUS, GWT is not a part of solution. Solution means ALL layers (data, business, presentation) combined. This what Jboss Seam gives. It's JSF (as many improved JSF variant, like Tomhawk,i forggotten names, but there are more GOOD JSF implementations ) is perfect, as part of larger solution !!! I vote for JSF and I knoq what I mean.

http://javafuck.wordpress.com/2010/07/28/gwt-is-abbreviation-for-greedy-and-wasteful-technology/

Peter