Manage Learn to apply best practices and optimize your operations.

Inside the Google Web Toolkit

Ed Tittel digs into the developer tools and Ajax functionality inside the Google WebToolkit.

Those who work with Java and develop for Ajax are likely to already be in the know about the Google Web Toolkit. Those outside this sphere of violent and vigorous activity may not be savvy yet ... and that's why I want to draw this item to your attention. As part of its purported pathway to global hegemony, Google introduced its free tool set earlier this year (May, 2006) using an open source model like that for Apache. Also known as GWT, this toolset includes a Java-to-JavaScript compiler and a hosted Web browser that ships in binary-only form, subject to the terms and conditions on the GWT Toolkit SDK page.

To be more specific, the GWT Java class libraries are open source under the Apache License Version 2.0. The Java-to-JavaScript compiler and hosted Web browser fall under the GWT license, but all code created using GWT remains the property of its developers. As the Web page puts it, "Google does not assert any intellectual property rights to code or content that you create using GWT."

The draw to GWT is that it lets developers work within the confines of their favorite development environment, using whichever GWT libraries they may find relevant or useful in building their applications. The Java-to-JavaScript compiler permits developers to convert any application into a set of JavaScript and HTML files that will work with any Web server. As an added bonus, it's possible to confirm that an application works in each browser a developer seeks to support and usually requires no additional effort.

The benefits of working in Java, then translating to JavaScript may be summarized as follows:

  • Developers can use their development tools of choice (JUnit, JProfiler, IntelliJ, Eclipse and so forth) for Ajax development.
  • Type checking in Java helps eliminate coding errors.
  • JavaScript errors get caught at compile time, not by users at runtime.
  • Automated Java refactoring tools can improve code quality and efficiency prior to translation.

The biggest of these benefits has to be familiarity for those already working with Ajax and code rigor for those used to working with object-oriented design and modeling tools.

GWT offers a set of UI components known as Widgets to construct UI elements for an Ajax application. Widgets combine in Panels that manage the layout for the Widgets they contain. The Google Web Toolkit Product Overview includes a simple example of a complete application that shows a button with an associated click handler. The notation is succinct, simple and surprisingly readable. Available widgets include modal dialog boxes, tab bars, menu bars and even hierarchical trees. A complete list of features provides all the gory details.

Those interested in rapid development of Web-based applications, like Google's own recent spreadsheets offering, are bound to find what GWT has to offer both interesting and compelling. It's certainly worth a look and perhaps even some experimentation, for those interested in building Web-based apps.

About the author

Ed Tittel is a full-time writer and trainer whose interests include XML and development topics along with IT Certification and information security topics. E-mail Ed at with comments, questions or suggested topics or tools for review.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.