Sep 25, 2013

Unlocking the Java EE Platform with HTML5 - JavaOne 2013

Unlocking the Java EE Platform with HTML5


Geertjan Wielenga, David Haefelfinger and me (Johannes Weigend) did a interessting Talk about HTML5 and JavaScript in combination with Java EE7. I will now share my thoughts here.

What I did was a typical HTML5 Application with a pure HTML/JS Client and a REST Server Backend. The Application looks like this:






This is a typical Single-Page Application with two logical Screens. After entering a search expression the logo disapears (annimated) and the result list fades in. The Architecture of this application looks like this.






As you can see on the Architecture Overview, the Client is developed with HTML5/JavaScript and CSS. The Client executes a Rest Call to a Glassfish 4 Server which is built by using JEE7 and JAXRS. On the client side I use JQuery for AJAX Interaction and DOM access. Knockout.JS for binding (The JSON result of the REST Call back to out HTML code) and bootstrap which gives me a column oriented (and responsive) layout. 

I also integrate an EJB-Session Bean to get the REST-Annotated-Code clean of business/searchlogic. This kind of Client has some benefits over a typicall JEE Java Server Faces application.
  • The Server itself can be stateless – so we can distribute free in the cloud – each call can go to a different server. That helps for scalability
  • The development is HTML5/JS/CSS for the client and pure Java on the server. We have a clean separation of concerns – and we can distribute the development easily in different teams.
  • We can use JavaScript libraries on the client – like bootstrap – where the server is PHP.

This kind of client has also some pain points
  • JS is currently not typed. So the autocomplete support is limited. Refactoring is a nightmare. Microsoft works currently on Typescipt which should make is easier for such tools. Netbeans support for typescript is on the way.
  • The current library situation is like the Wild West. Everybody claims to have the best library for application development – There are many unsolved questions if you want to build enterprise scale applications on that unsafe basis.
But nevertheless, this kind of application is a current trend. I will show you in this blog how to build this application with Netbeans 7.4 and Glassfish 4.

The video shows every step of my demo at the JavaOne.

video





No comments:

Post a Comment