Google Web Toolkit: Cross-Browser Web Apps Made Easy

Written by: jascha in Product Reviews, Web Technology

Developing a Web Application today is a tedious process. Developers can spend up to 90% of their time ironing out cross-broswer quirks and formatting differences for specific web browsers. Building and maintaining Javascript and AJAX components on a large scale can be difficult and fragile. This is where Google Web Toolkit steps in. Google Web Toolkit, or GWT, is a Javascript and AJAX framework. GWT web applications are written in the Java programming language. The GWT then compiles several versions of your site, including all of the javascript, HTML, and CSS to go along with it. These compiled sites are then loaded dynamically by your web browser. Your web browser then only loads and executes the specific Javascript applicable.  This minimizes the javascript used by the browser, making sites more responsive and less error prone. In addition, developers are able to choose their favorite Java development tools like Eclipse, IntelliJ, Jprofiler, JUnit, and others.

GWT also comes pre-packaged with a “Hosted Mode Browser” allowing developers to see changes they’ve made in thier code in real-time.  No more having to wait for the compiler to finish.  Just save your changes and click refresh. Developers can also step through their AJAX code in real-time, allowing them to properly identify and resolve bugs quickly. When the site is ready for deployment GWT compiles your Java code into plain Javascript that can be served from any web server. GWT Applications automatically support IE, Firefox, Mozilla, Safari, and Opera with no browser detection or special-casing scattered throughout your code. You write the code once, and GWT transforms it into the most efficient Javascript for each users browser.

GWT makes writing rich AJAX based web application easy. Its robust set of compatible transfer protocols make it able to communicate effectively with other web applications and servers. You simply create an interface that specifies remote procedures to be called, and GWT will automatically serialize the arguments, invoke the proper methods on the server, and de-serialize the return value for the client. GWT’s Remote Procedure calls are also quite sophisticated, allowing polymorphic class hierarchies, object graph cycles, and exception handling.

You can create re-usable components for use across multiple projects. Once a “Widget”, or UI element is created, you can easily lay them out in Panels. These widgets can easily be moved and attached to a panel in another project with a small amount of work.

GWT allows you to also use existing Javascript libraries and native Javascript code. If GWT’s class library doesn’t suit your needs, you can mix in hand-written Javascript into your Java source code using its Javascript Native Interface. You can also “subclass” Javascript Objects to create Java Class Overlays.

Most AJAX applications break when a user clicks the back button. Implementing history into an AJAX application has been a major hurdle for most developers. GWT allows you to easily add history support making your web applications more user-friendly and intuitive.

Google Web Toolkit is a giant leap forward in web application development and will only grow and become more effective.

Google Web Toolkit is an Open-Source product available under the Apache 2 Licence

GWT Home:

GWT Showcase with source code: