GWT in Action
Easy Ajax with the Google Web Toolkit
Robert Hanson and Adam Tacy
  • June 2007
  • ISBN 9781933988238
  • 632 pages
This title is out of print and no longer for sale.

... impressive quality and thoroughness. Wonderful!

Bernard Farrell, Software Architect, Kronos Inc.

Second edition of this book is available

The Web is experiencing a new growth with an emphasis on rich, web-based applications. These applications can be difficult to build because they rely on JavaScript, which lacks the sophisticated object-oriented structures and static typing of Java, they are tricky to debug, and they require you to manage numerous browser inconsistencies.

The Google Web Toolkit (GWT) is a new technology from Google that automatically translates Java into JavaScript, making Ajax applications easier to code and deploy. GWT in Action is a comprehensive tutorial for Java developers interested in building the next generation of rich, web-based applications. This book was written by Robert Hanson, creator of the popular GWT Widget Library, and Adam Tacy, a major contributor to the GWT Widget Library.

Table of Contents show full



about this book

about the title

about the cover illustration

Part 1 Getting started

1. Introducing GWT

1.1. A walk through GWT

1.2. GWT vs. other solutions

1.3. Building your first GWT application

1.4. Summary

2. Creating the default application

2.1. The GWT application development lifecycle

2.2. Stage 1: Creating a GWT application

2.3. Summary

3. Advancing to your own application

3.1. Describing the application example

3.2. Stage 2: Developing your application

3.3. Stage 3: Testing and debugging in hosted mode

3.4. Stage 4: Compiling the code

3.5. Stage 5: Deploying the code

3.6. Stage 6: Running in web mode

3.7. Implementing application logging

3.8. Summary

Part 2 Building user interfaces

4. Working with widgets

4.1. What is a widget?

4.2. The standard GWT widgets

4.3. Creating new widgets

4.4. Developing the Dashboard’s ToggleMenuItem widget

4.5. Summary

5. Working with panels

5.1. What is a panel?

5.2. The standard GWT panels

5.3. Creating new panels

5.4. Creating the Dashboard panel

5.5. Summary

6. Handling events

6.1. Exploring events

6.2. Listening to events

6.3. Handling standard browser events

6.4. Handling other event types

6.5. Implementing drag-and-drop

6.6. Summary

7. Creating composite widgets

7.1. What is a composite widget?

7.2. Composite widget development steps

7.3. Building the editable label

7.4. Creating a composite widget from other composite widgets

7.5. Creating the Dashboard composite

7.6. Summary

8. Building JSNI components

8.1. Introducing JavaScript Native Interface (JSNI)

8.2. Communicating using JSNI

8.3. Loading a JavaScript library

8.4. Wrapping a simple JavaScript library

8.5. Wrapping a complex JavaScript library

8.6. Summary

9. Modularizing an application

9.1. Creating a modularization structure

9.2. Including third-party modules

9.3. Packaging your own modules

9.4. Creating the Java package structure

9.5. Summary

Part 3 Advanced techniques

10. Communicating with GWT-RPC

10.1. Underlying RPC concepts

10.2. Implementing GWT-RPC

10.3. Project summary

10.4. Summary

11. Examining client-side RPC architecture

11.1. Structuring the client code

11.2. Examining different polling techniques

11.3. Writing custom field serializers

11.4. Summary

12. Classic Ajax and HTML forms

12.1. Classic Ajax with RequestBuilder

12.2. Examining FormPanel basics

12.3. Summary

13. Achieving interoperability with JSON

13.1. Introducing JavaScript Object Notation (JSON)

13.2. Examining GWT’s JSON data objects

13.3. Creating a search component using JSON

13.4. Implementing a Yahoo Search proxy service

13.5. Summary

14. Automatically generating new code

14.1. Generating new types

14.2. Investigating GWT generators

14.3. Creating a generator for the Dashboard

14.4. Summary

15. Changing applications based on GWT properties

15.1. Quick summary of properties

15.2. Managing browser differences

15.3. Supporting internationalization in full

15.4. Altering the application for the locale

15.5. Implementing user-defined properties

15.6. Summary

Part 4 Completing the understanding

16. Testing and deploying GWT applications

16.1. Testing GWT code using JUnit

16.2. Deploying GWT applications

16.3. Summary

17. Peeking into how GWT works

17.1. Examining the compilation process and output

17.2. The GWT application-loading mechanism

17.3. Compiling Java to JavaScript

17.4. Summary


About the Technology

In May of 2006 Google released the Google Web Toolkit. GWT enables developers to create Ajax applications in Java. With GWT, you can build your applications using a real object-oriented language and take advantage of Java tools like Eclipse that are already available. Instead of trying to bring tool support to Ajax, Google brought Ajax to a place where the tools already existed.

About the book

GWT in Action shows you how to take advantage of these exciting new tools. This clearly-written book is packed with hands-on GWT examples. You'll absorb the GWT philosophy as you build your first working GWT application.

The book begins by exploring the main features of GWT, including

  • Compiling Java to JavaScript, the magic that really defines GWT
  • Building client-side components
  • Convenient JUnit integration and testing
  • Interacting with JavaScript and existing JavaScript libraries
  • Internationalization

You'll also see how GWT compares to other toolkits.

GWT in Action shows you how to set up your development environment, use and create widgets, communicate with the server, and much more. Readers will follow an example running throughout the book and quickly master the basics of GWT: widgets, panels, and event handling. The book covers the full development cycle, from setting up your development environment, to building the application, then deploying it to the web server. The entire core GWT library is discussed, with details and examples on how it can be extended.

You'll cover:

  • Testing, debugging, and deploying GWT Applications
  • Communicating with GWT-RPC
  • Examining client-side RPC architecture
  • Alternative RPC tools: HTTPRequest, RequestBuilder, and FormPanel
  • Achieving interoperability in GWT with JavaScript Object Notation (JSON)
  • Making your GWT application flexible and supportable

GWT helps you make the most of Ajax in your web applications and GWT in Action helps you get more out of GWT.

What's inside

  • Comprehensive GWT tutorial
  • Build a full-scale GWT application
  • Interacting with the server using GWT-RPC, JSON, and other tools
  • Building, testing, and deploying GWT applications

About the authors

Robert Hanson is a US-based senior Internet engineer and creator of the popular open source GWT Widget Library. Robert also maintains a blog at where he talks about GWT and other topics relating to the industry.

Adam Tacy is a consultant working for WM- Data in the Nordics and a contributor to the GWT Widget Library project.