views:

2055

answers:

4

Hi,

GWT seems like a really nice technology for Java developers who don't like (or don't know) HTML/JS/CSS to build rich web interfaces. On the server-side Grails also looks really nice, it's often described as "Rails for Java developers". I've read that Grails' "convention over configuration" approach, together with the benefits of dynamic languages (Groovy) can really reduce the amount of (boilerplate) code that needs to be written, while still leveraging best-of-breed Java technologies such as Spring and Hibernate.

Anyway, I haven't read much about how well these technologies play together. How easy is it to integrate GWT with Grails on the server-side? I'd be interested to learn about experiences of anyone that has build an application with these technologies? Recommendations on resources (books/websites) for building a GWT-Grails website would also be very welcome.

Cheers, Don

A: 

with the benefits of dynamic languages (Groovy) can really reduce the amount of (boilerplate) code that needs to be written

That's what folks from RoR camp was preaching all the time. After some initial boom RoR projects got into inevitable trouble with bigger projects. The bigger projects the more work one should delegate to compiler, i.e. the more valuable are static languages. Currently, RoR boom is all but gone.

The amount of (extra) code you need to write now with JPA/Hibernate, for instance, is almost zero. Annotations only. It even finds the mapped beans itself, in runtime, via classpath! SpringFramework makes many other "boilerplate" codepieces obsolete too.

In my GWT project (one so far, have to admit) I use JPA (Hibernate), DAO layer, business delegate pattern and it's easy and robust.

Vladimir Dyuzhev
FWIW, I disagree with your suggestion that static languages are "the one true path". The dynamic languages camp would argue that the verbosity of static type checking is partly responsible for the "big projects" you mention.
Don
+5  A: 

Grails already has a gwt plugin: check it out.

Miguel Ping
+2  A: 

You did mention on the server side - GWT and grails actually doesn't integrate well on the serverside (not as well as you might expect given how well grails domain objects work). For RPC, the plugin it works really well.

The problem is that domain objects cannot be serialized and tranfered across the wire - after all, they groovy objects. You will need to custom make a data transfer object (DTO), and do the marshalling manually. It is possible to automate it, but there isnt any opensource code out there that does it atm - so rolling your own is the only solution.

Or see if you can get Hibernate4gwt to work with grails - but i doubt it will out of the box either.

Chii
addendum: GWT now integrates fairly well with grails 1.1.x - the gwt plugin is vastly improved from what i hear.
Chii
A: 

Another approach: use Grails with SmartGWT. Instead of GWT-RPC (too complex, and as others have noted, doesn't play well with Grails) use REST-based integration, since Grails has great support for serializing to XML or JSON and SmartGWT has built-in REST support. Take a look at this blog showing sample source - it's ridiculously easy to build a reusable master-detail screen for any Grails object.

http://josip-dev.blogspot.com/2010/06/grails-smart-gwt.html

Charles Kendrick