GWT (Google Web Toolkit)

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

This section is written against GWT 2.13.1 (released 2026-06-19), the version managed by the org.gwtproject:gwt BOM, together with gwt-maven-plugin 1.3.0 (net.ltgt.gwt.maven), the modular-webapp archetype 2026.6.22, JDK 21 running the tools with -sourceLevel 17, Jakarta Servlet 6 on Jetty 12 and Elemental2 1.3.2 (versions verified on 2026-10-08). GWT is a community-run open-source project: Google created and released it in 2006, a steering committee has governed it since 2012, and volunteers publish the releases at a slow but steady pace of roughly one or two a year. The 2.13 line is the current one, and the roadmap says that 2.13.0 is likely the last release whose compiler and tools run on Java 11. There is no GWT 3 release: Google’s own successor to the GWT compiler is J2CL, a separate Java-to-JavaScript transpiler used inside Google, and the org.gwtproject.* libraries are being prepared to work with both compilers. Where the book listed in the bibliography or older tutorials describe different behaviour, the pages say so, and What’s Changed & Migration collects every difference in one place.

What GWT is

GWT is a Java-to-JavaScript compiler together with a toolkit. You write the browser side of a web application in Java, with an IDE, a type checker and JUnit, and the compiler turns it into optimised, obfuscated JavaScript that runs in every current browser. It is not a server-side UI framework: nothing of the Java code you compile runs on the server, and the server is any ordinary Java (or non-Java) backend that exposes services.

A single toolchain provides:

  • the compiler, with whole-program optimisation, dead-code elimination, one compiled permutation per combination of locale and browser flavour, deferred binding to pick implementations at compile time and code splitting to download the application in parts

  • a JRE emulation library, so that a subset of java.lang and java.util and your own shared classes behave in the browser as they do on the JVM

  • Super Dev Mode, which recompiles in seconds and lets you debug the Java source in the browser’s developer tools

  • widgets, panels and layout panels, the event and handler system, UiBinder templates, cell widgets and data providers, the Editor framework, ClientBundle resources with CSS and GSS, internationalization, history, Activities and Places, Bean Validation and logging

  • client-server communication: GWT-RPC, RequestBuilder with JSON and XML, RequestFactory and the hooks that REST libraries use

  • interoperability with JavaScript through JsInterop and Elemental2, and the legacy JSNI and overlay types

  • unit testing with GWTTestCase and plain JUnit, and the security classes SafeHtml and the XSRF tokens

This section is for developers who:

  • know Java and want to build rich single-page browser applications without writing the client in JavaScript or TypeScript, sharing classes and validation rules with a Java server

  • maintain an existing GWT application, often one written for GWT 2.0 to 2.8, and need the current idioms for org.gwtproject, Jakarta servlets, JsInterop and the net.ltgt Maven plugin

  • learned GWT from the 2007 book or from older tutorials (hosted mode, listeners, ImageBundle, webAppCreator) and need to know what still applies

  • are choosing between GWT and a server-rendered Java framework or a TypeScript framework, and want the trade-offs

The Bookshelf scenario

Every example builds one small original application, Bookshelf, in the same domain as the Thymeleaf, Django, PHP and Laravel and Next.js sections, so that the stacks can be compared page by page. Here it is a three-module GWT 2.13 application generated from the modular-webapp archetype:

  • bookshelf-shared: plain Java used on both sides, such as the Book, Author and Review classes, the RPC service interfaces and the Bean Validation constraints

  • bookshelf-client: the code compiled to JavaScript, with the EntryPoint, a UiBinder shell, a DataGrid catalogue, Activities and Places, an Editor-based book form, English and Spanish messages, a ClientBundle with GSS, a JsInterop binding to a chart library and GWT.runAsync split points

  • bookshelf-server: a Jakarta servlet backend (Jetty for development, plus a Spring Boot variant) with a GWT-RPC CatalogService protected by XSRF tokens and a small REST/JSON endpoint called with RequestBuilder and a REST library

  • tests: GWTTestCase with HtmlUnit, plain JUnit tests of presenters with mocked views, server-side RPC tests and a Playwright end-to-end test

Diagram of the Bookshelf architecture. The bookshelf-client and bookshelf-shared modules are compiled by the GWT compiler into bookshelf.nocache.js and one cache.js file per permutation. The bookshelf-shared and bookshelf-server modules are compiled by javac and war packaging into classes that run in a servlet container on the JVM. The browser loads the JavaScript from the server through a script tag in the host page, then talks to the server with GWT-RPC protected by an XSRF token and with REST and JSON through RequestBuilder.
Figure 1. The Bookshelf: shared, client and server modules, the GWT compiler producing JavaScript, and the browser talking to the server with GWT-RPC and REST

The final project layout (bookshelf-client/src/main/java packages for client/{ui,activity,place,resources,i18n}, the Bookshelf.gwt.xml module file, bookshelf-shared/src/main/java with the shared package, and bookshelf-server/src/main/java with the server package plus src/main/webapp/index.html and WEB-INF/web.xml) is assembled on Getting Started.

Reading path

The pages are ordered so that each one builds on the previous ones. Read them in this order the first time, then use them as a reference. Before starting, be comfortable with the language and the build underneath: the Java Reference for generics, annotations, lambdas and the Maven basics, and, for the backend variant of the Bookshelf, the SpringBoot Reference.

  1. Foundations: what GWT is, a first project, the module XML, the build, the compiler, development mode and the JRE emulation.

  2. Java and JavaScript: JsInterop, the legacy JSNI, the DOM and Elemental2, deferred binding and the scheduler.

  3. Building user interfaces: widgets, panels, events, custom widgets, UiBinder, cell widgets, Editors, styling, ClientBundle, HTML5, accessibility and internationalization.

  4. Application architecture: history, Activities and Places, validation and logging.

  5. Client-server communication: the overview, GWT-RPC, RequestBuilder, REST libraries, RequestFactory and the server integration and deployment.

  6. Security: SafeHtml and XSS, then XSRF and server-side security.

  7. Performance and optimisation: code splitting, compile reports and linkers.

  8. Testing, then the ecosystem, the future and migration, and finally the cheat sheet.

mindmap root((GWT)) Foundations Compiler and permutations Maven and module XML Super Dev Mode JRE emulation Java and JavaScript JsInterop JSNI legacy Elemental2 Deferred binding User interfaces Widgets and panels Handlers UiBinder Cell widgets Editors ClientBundle and GSS Internationalization Architecture History Activities and Places Validation Logging Communication GWT-RPC RequestBuilder REST libraries RequestFactory Deployment Security SafeHtml XSRF Performance Code splitting Compile report Linkers Quality and future Testing Ecosystem J2CL Migration

What’s covered

Each page builds on the Bookshelf scenario, links every example to the official page it derives from, and ends with the sources it uses.

Foundations

  • Introduction & Architecture: what GWT is, permutations and deferred binding, the client, shared and server split, the history from 2006 to 2.13, governance, and a comparison with J2CL, Vaadin Flow, JSF, Thymeleaf, Angular, React and Vue

  • Getting Started: prerequisites, the modular-webapp archetype, the development loop and the full Bookshelf project

  • Project Structure & Modules: every module XML element, inheritance, the host page and packaging libraries

  • Build Tools: Maven & Gradle: the gwt-maven-plugin goals, the BOM, reactor builds, the legacy plugin and the state of Gradle

  • Compiler & Compilation: every compiler flag, source levels, output styles, permutations and the output directory

  • Development Mode & Debugging: Super Dev Mode, source maps, DevMode today and the code server caveats

  • JRE Emulation & Shared Code: what the emulation provides, Java language levels, numeric semantics, super-source and the GWT class

Java and JavaScript

Building user interfaces

  • Widgets: the widget model, the class hierarchy, the attach lifecycle and the widget gallery

  • Panels & Layout: basic panels, the layout panels, resizing and CSS versus table layout

  • Events & Handlers: DOM handlers, HandlerRegistration, preview handlers and the event bus

  • Custom Widgets & Composites: Composite, the interfaces to implement and new panels

  • UiBinder: the owner class and ui.xml pair, fields, handlers, styles and UiBinder i18n

  • Cell Widgets: cells, CellTable, DataGrid, data providers, pagers, selection and custom cells

  • Editors: binding a bean graph to editors, drivers, adapters and RequestFactory integration

  • Styling: CSS & GSS: style names, themes, CssResource, GSS and the migration

  • ClientBundle & Images: every resource type, sprites, inlining, caching and ImageBundle migration

  • HTML5 Features: storage, canvas, audio and video, geolocation and feature detection

  • Accessibility & ARIA: the ARIA library, focus management and keyboard navigation

  • Internationalization: Constants, Messages, plurals, locales, Dictionary and formatting

Application architecture

  • History & Navigation: tokens, History, Hyperlink and bookmarkable state

  • MVP, Activities & Places: the MVP pattern, Place, ActivityManager, PlaceController and dependency injection

  • Validation: Bean Validation on the client, sharing constraints with the server

  • Logging: java.util.logging emulation, handlers, remote logging and stack-trace deobfuscation

Client-server communication

Security

  • SafeHtml & XSS: the DOM sinks, the SafeHtml family, sanitizers, Content Security Policy and the 2012 and 2013 CVEs

  • XSRF, RPC & Server Security: XSRF tokens, JSON hijacking, deserialisation risks and the code server

Performance and optimisation

Testing

  • Testing: GWTTestCase, run styles, plain JUnit tests, coverage and Playwright

Ecosystem, the future and migration

The GWT pages link to existing material instead of repeating it, and cover only what GWT adds.

Topic Where it lives How the GWT section relates

The Java language and build basics

Java Reference, including Generics, Annotations and Reflection, Lambdas and Method References, Records and Sealed Classes, Build and Tooling and Testing

The JRE-emulation page explains which of these language features GWT supports and what the emulation library lacks.

The Spring Boot backend of the Bookshelf

SpringBoot Reference, including Getting Started with Spring Boot, REST APIs with Spring MVC and WebFlux, Spring Security and Unit and Integration Testing

The server-integration and security pages show only the GWT-specific wiring of a Spring Boot jar, its REST API and its CSRF tokens.

Choosing a web UI technology

Server-Side Web UI Frameworks, Vaadin Reference, JSF (Jakarta Faces), Thymeleaf, Angular Reference, React Reference and Vue.js Reference

The introduction compares GWT with these technologies. Vaadin Framework 6 to 8 used GWT for its client-side engine.

The same ideas in other stacks

Thymeleaf Internationalization, ASP.NET Core Globalization and Localization and Next.js Internationalization

The internationalization page points to these pages for the same idea elsewhere.

Web security and cross-origin requests

Template Security & XSS and What is CORS?

The security pages and the communication overview link here for XSS, the same-origin policy and cross-origin RPC and JSON.

Front end: HTML and CSS, Sass, accessibility

HTML & CSS Reference, Sass Reference, Web Accessibility

The styling, ClientBundle and accessibility pages link here for the CSS and accessibility theory.

Browser testing

E2E Testing in Real Browsers

The testing page links this page for Selenium, Playwright and Cypress, next to the GWT-specific GWTTestCase.

Media

Media Optimization for the Web

The ClientBundle page covers GWT’s own image bundling, sprites and data URLs; this page covers images and video in general.

Containers, orchestration and cloud

Docker, Kubernetes and Cloud

The server-integration-and-deployment page shows only the GWT-specific parts.

Some related topics are tracked as separate issues and are only mentioned here: a comparison of backend and web frameworks (#263), chat, videoconference and WebSockets (#264), Playwright, Cypress and Selenium (#258) and IDE links (#116). JSF (#239) and Thymeleaf (#238) are documented in their own sections, linked in the table above, and Struts and JSP (#241) in the JSP & Struts section.

Bibliography

Every source used to prepare this section is listed here, each linked to its official site. Individual pages list the subset they derive from under their own == References heading.

Books

The book below was consulted for concept coverage, narrative and structure only. It targets GWT 1.3 and 1.4 (2007), which predate handlers, UiBinder, ClientBundle, cell widgets, RequestFactory, Super Dev Mode and JsInterop. No text, code listing, figure or sample project is taken from it: every example in this section is written against the current official documentation, and the pages point out where the book is outdated.

  • Hanson, R. and Tacy, A. GWT in Action: Easy Ajax with the Google Web Toolkit. Manning Publications, 1st edition, 2007. ISBN 1-933988-23-1. Publisher page: manning.com/books/gwt-in-action.

  • Further reading only, not consulted: the second edition of the same book, by Adam Tacy, Robert Hanson, Jason Essington and Anna Tökke (Manning, 2013), described on its Manning page.

Specifications, standards and security sources

The book is a consulted reference for concept coverage, narrative and structure; it is not reproduced here. The official documentation linked above is authoritative, and where the two differ, the documentation of the version you run prevails.