The GWT takes an unusual approach to Web application development. Rather than employing the normal separation of client-side and server-side codebases, GWT provides a Java API that lets you create component-based GUIs and then compile them for display in the user's Web browser. Using GWT is far closer to developing with Swing or SWT than the usual experience of Web application development, and it tries to abstract away the HTTP protocol and the HTML DOM model. Indeed, the fact that the application ends up being rendered in a Web browser feels almost incidental.
GWT achieves these feats through code generation, with GWT's compiler generating JavaScript from your client-side Java code. It supports a subset of the java.lang and java.util packages, along with the APIs that GWT itself provides. A compiled GWT application consists of fragments of HTML, XML, and JavaScript.
Listing 1 shows the Java source code of pretty much the simplest possible application you can make using GWT:
This looks a lot like GUI code you might have written in Swing, AWT, or SWT. As you can probably guess, Listing 1 creates a button that displays a "Hello World!" message when you click it. The button is added to the RootPanel, a GWT wrapper around the body of an HTML page. Figure 1 shows the application in action, running inside GWT Shell. The Shell is a debugging hosting environment, incorporating a simple Web browser, that's included in the GWT SDK.
Figure 1

GWT is a comprehensive framework that provides a great deal of useful functionality. However, GWT is something of an all-or-nothing approach, targeted at a relatively small niche in Web application development market.