views:

145

answers:

1

There are about as many questions on this site about Java web application frameworks as there are frameworks themselves, but I'll try to make this question as specific as possible.

I'm developing web applications to mirror my company's Java applications. (Unfortunately, they don't have pure presenter layers so I can't just make another "view".) We're targeting mobile phones (including Blackberry and Windows Mobile 6.5+, not just iPhone and Android).

In a framework, I'd like:

  • Progressive enhancement (the page needs to retain full functionality without JavaScript)
  • Fully standards-based, strict HTML
  • Presentation/layout should be done primarily with CSS
  • Some sane model like MVP would be nice so if we do need more views/interfaces to our apps in the future we're not having to rewrite the app yet again
  • Write business logic/validation once and get it server-side, sent back to the client on POST, client-side via JavaScript for functions that don't need info from the server, and client-side via AJAX for functions that do need information from the server
  • Being able to debug in the Java IDE would be best since most of the employees here are familiar with Java, but I'm comfortable using both Java IDEs and the usual web tool-chain such as Firebug, Chrome Dev Tools, etc.
  • Being able to unit test well, although that goes along with having a sane model

I've been looking at GWT and while things like deferred binding certainly are nice, browser sniffing and separate code paths for each browser instead of object/feature detection (especially in a market as volatile as the mobile phone market is right now) scare me, and in order to have full Blackberry support we probably couldn't use most of their built-in controls/layout panels/widgets anyway, not to mention a lot of their widgets just completely die with JavaScript turned off. I'm also just starting to evaluate JSF, Grails, Wicket, etc.

Are there any frameworks out there that address those concerns that I've been too thick to find, or would I be better off using a framework like GWT as a jumping off point while just writing all of our own controls from scratch? I'm fine with a bit of start-up pain; whatever we end up doing here will probably be used for all of our web applications (both mobile and not) so I'm hoping that the SO community would have some good insight that I might not.

Thanks!

A: 

For anyone else looking for frameworks like I was, here's what I've found (as of GWT 2.0):

JavaScript and Progressive Enhancement
GWT, of course, absolutely requires JavaScript to function. If you want your page to be fully functional without JavaScript, you'll have to write everything using the standard web stateless page reload model. You can still use GWT for progressive enhancement but if you want nice AJAX functionality and the full form POST model to work, you'll end up essentially writing everything twice, so you may be much better off using something like Closure Tools and Templates or another solution (such as another Java web framework or even plain old JSP or JSF plus a JavaScript framework like jQuery).

Layout/Widgets
GWT's built-in panels and widgets are well-suited to creating desktop-like UI, but there aren't very many that are designed to work with fluid layouts. If you need fluid layouts you will be writing a lot of your own layout panels or overriding the display of existing panels. The built-in controls work pretty well with Android and iPhone, but if you need to support platforms that aren't using mobile WebKit (e.g. Blackberry before OS 6), again, you'll be doing a lot of custom work. For simple things, you can get away with building custom widgets by compositing built-in controls, but for more advanced widgets you'll probably have to dive into some heavier HTML/CSS/DOM/JSNI work or use a third-party library.

Validation
There are a couple of good validation libraries, but validation is not built in to GWT as of 2.0. Google is working on integrating JavaBean validation, but I'm not sure if it will make 2.1. Also, the currently available third-party validation libraries seem to validate the entire object all at once; if you need more fine-grained validation such as just validating one field at a time you'll still have extra work to do (or you'll be validating the entire object and throwing the other results away, which is a bit inefficient). There is definitely room for improvement in this area.

Mobile
As far as the mobile aspect is concerned, jQuery Mobile (which will be a part of jQuery 1.4.3 on) should see its first release in mid-October of 2010. It may be possible to mix GWT and jQuery so that you're not having to write as many custom widgets in GWT but I won't have a chance to try that out until release.

Like Google says, GWT is a tool chain, so you can use as little or as much as you like. Even if you can't use many of their built-in controls, the benefits of compilation, etc. made it worth it for us.

Most of the Java frameworks other than GWT tended to abstract the web portion away too much for my taste since I'm apparently one of the strange breed that's comfortable both with web technologies and Java/OOP. GWT seems to strike the best balance I've seen by making those only familiar with Java comfortable while letting those of us with web knowledge dive in as deeply as we'd like.

Nate Bundy