About GWT

GWT Logo

The Google Web Toolkit (GWT) is a way for you to write AJAX front-ends using the Java programming language. The basis of how GWT works is through a compiler that converts Java source code into JavaScript, creating an application compliant with most of today’s browsers. The GWT compiler also eliminates dead code, removing unused classes, methods, fields, as well as method parameters, which reduces the amount of overhead to provide the smallest script possible for your web application.

Below you will find some of the features of the Google Web Toolkit.

Communicate with your server through really simple RPC

GWT supports an open-ended set of transfer protocols such as JSON and XML, but GWT RPC makes all-Java communications particularly easy and efficient. Similarly to traditional Java RMI, you simply create an interface that specifies remote methods you’d like to be able to call. When you call a remote method from the browser, GWT RPC will automatically serialize the arguments, invoke the proper method on the server, then deserialize the return value for your client code. GWT RPC is quite sophisticated, too. It can handle polymorphic class hierarchies, object graph cycles, and you can even throw exceptions across the wire.

Optimize the JavaScript script downloads based on user profile

Deferred binding is a feature of GWT that generates many versions of your compiled code, only one of which needs to be loaded by a particular client during bootstrapping at runtime. Each version is generated on a per browser basis, along with any other axis that your application defines or uses. For example, if you were to internationalize your application using GWT’s Internationalization module, the GWT compiler would generate versions of your application per browser environment, such as “Firefox in English”, “Firefox in French”, “Internet Explorer in English”, etc… As a result, the deployed JavaScript code is compact and quicker to download than if you coded if/then statements in JavaScript.

Reuse UI components across projects

Create reusable Widgets by compositing other Widgets, then easily lay them out automatically in Panels. The GWT Showcase application provides an overview of the various UI features in GWT. Want to reuse your Widget in another project? Simple package it up for others to use in a JAR file.

Use other JavaScript libraries and native JavaScript code

If GWT’s class library doesn’t meet your needs, you can mix handwritten JavaScript in your Java source code using JavaScript Native Interface (JSNI). With GWT 1.5, it is now possible to subclass the GWT JavaScriptObject (JSO) class to create Java “class overlays” onto arbitrary JavaScript objects. Thus, you can get the benefits of modeling JS objects as proper Java types (e.g. code completion, refactoring, inlining) without any additional memory or speed overhead. This capability makes it possible to use JSON structures optimally.

Easily support the browser’s back button and history

No, AJAX applications don’t need to break the browser’s back button. GWT lets you make your site more usable by easily adding state to the browser’s back button history.

Localize applications efficiently

Easily create efficient internationalized applications and libraries using GWT’s powerful deferred binding techniques. In addition, as of 1.5 the standard GWT widgets support bi-directionality.

For more information about GWT, click here.

Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Comment are closed.