YouBrew Ext JS starter app
13/03/2011A Java, Spring, Hibernate, Spring-MVC, RESTful services, JSON, Ext JS starter app…
Last year, I put together a little homebrew starter Spring webapp with a Flex frontend (writeup here). Over the last year, I’ve written a few Java Spring webapps with Ext JS frontends. So, I decided to revisit my youbrew starter app to create an Ext JS version.
For those that would rather get cracking with the code than listen to me blather on about it, here you go: https://github.com/jacobheric/youbrew-extjs.
For those of you who just want to see it running, here you go: http://jacobheric.com:8080/youbrew-extjs.
Ext JS
For those of you that live under a rock, Ext JS is a javascript UI component framework. Check it out over here: http://www.sencha.com/. As far as javascript UI component frameworks go, I think Ext JS is without peer. They offer good API documentation, healthy forum support, and an example component gallery that is very impressive and compelling: http://dev.sencha.com/deploy/dev/examples/. They’ve also moved into the mobile space with an HTML5 touch offering that’s really interesting and could eventually provide a viable alternative to writing native mobile apps for a variety of platforms (Android, iOS, etc.).
Ext JS is offered under a dual license. It’s open source (GPL v3) if you’re developing an open source app. Otherwise, you’ll need to purchase a commercial license.
I’ve knocked out a few of these Ext JS java spring webapps in the last year. I’ve also developed in parallel at my current contract with another team working on similar Ext JS apps. I’m settling into an architecture similar to what you see in this starter app. My first project made heavy use of JSP tag libraries to manage the Ext JS components. Generating javascript in JSP tag libs is not pleasant and I would recommend avoiding that approach. I’ve found that it’s better to pitch Java based view component technologies altogether and work with a pure javascript front end.
You’ll see that this app brokers information to the view using RESTful JSON services. Ext JS components play very well with JSON (see the JSON data store component for example). Later versions of Spring MVC offer easy annotations based RESTful service setup and very slick Java/JSON serialization/deserialization (with the help of Jackson). The result is a nice match of technologies to marry the pure Javascript fronend to the “enterprise” Java backend. JSON is a perfect fit for sending data back and forth to a rich web app. It’s easy to work with. It’s clean and lightweight and fast. Communicating with the frontend using RESTful JSON also provides a nice platform for dropping in additional (or replacement) UIs and offers you a set of ready-made APIs for systems integration.