I am just back from
Profict's
AJAX day, a very nice way of promoting one's company among developers. There were 2 speakers:
Greg Murray, the AJAX architect from Sun and
Bram Smeets, the
DWR expert from Interface 21. In between there was a small product presentation from
BackBase.
4 hours for Greg Murray
Four hours were filled by a jetlaged Greg. It seems that because he got so much time he could not chose what to tell from the many presentations he brought with him. It was a shame everything was so jumbled up because there were some really nice things in there. Without going into too much detail, here are some of the things he presented.
jMaki
Greg is the main author for jMaki. jMaki is a small toolkit that allows you to wrap other Javascript toolkits (among others Dojo and Zimbra). jMaki comes standard with some nice widgets. Besides the usual datepickers and autocomplete stuff, there were some very nifty widgets that allow you write Mashups with Flickr, Yahoo Geocoder and Google Maps. A Mashup is a mashed combination of several web applications. One of his examples was a reworked Petstore where each pet was indicated on a map.
jMaki is available for JSP and JSF environments. But given the raw components (simply a html, css and js file) you can probably include this stuff in any other framework easily.
jMaki also has some other basic stuff. For example an eventing mechanism (modeled after Dojo) and XmlHttpProxy.
XmlHttpProxy is an XmlHttpRequest like feature that will allow you to call services in any domain by proxying the call on a server. This circumvents the security mechanism of Javascript in which you can only do HTTP requests to the domain from which the page was served.
AJAX, Back button and Anchor links
The trick of the day was the use of anchor links (the part after the #). When the user triggers an AJAX action (for example loading a different product), the URL of the currently loaded document is changed, but only in the anchor part. Since only the anchor changes, the browser will not reload the current page, but will add an entry to the page history. This means that suddenly the AJAX enabled page has a bookmarkable URL. In addition, much better back button support becomes possible.
Bram Smeets on DWR
The 1 and half hour presentation from Bram was a very nicely done introduction to DWR. In contrast to many other Javascript toolkits, DWR only provides communication between JavaScript and Java. However, as this presentation showed, DWR does so very well. In short, the idea behind DWR is that you can call a Java method directly from Javascript, and then can use the returned objects as if they are plain Javascript objects. If so desired, some utility Javascript functions can easily convert these objects to HTML and put them into the current page.
First an example was presented for DWR with plain Java and XML configuration. The few lines of Java and Javascript code on the slides showed that DWR is really a convenient thing to use. One of the killer features is a debug view of all exposed classes and methods.
After a pitch style introduction of Spring, Bram then showed how to configure DWR from Spring. Though the integration is indeed nice, it gives you no advantages when you are not using the Spring bean container for some other reason (which of course there are plenty).
Reverse AJAX
The audience really heated up with the topic of Reverse AJAX (a.k.a. Comet, Long poll and for some even as Pushlets). This experimental DWR feature allows you to execute Javascript from Java. A very very neat example showed a method call on a Java-Scriptaculous 'impersonator' on the server side, with as result that the Scriptaculous effect is applied in the browser. Unfortunately Reverse AJAX is still at an experimental stage. As Bram told me later, this is mainly because it has not been tested properly in many circumstances. In addition, you must be very aware of the load this brings to your server.
Barbecue
The day ended with a nice barbecue in the beautiful garden of Profict's castle.