Chapter 1. The Google Web Toolkit's Approach to AjaxA developer will typically create his Ajax application by writing XHTML pages and JavaScript code with his favorite integrated development environment (IDE) or even text editors. A number of different libraries and frameworks exist by which programmers can use pre-designed JavaScript classes to implement otherwise time-consuming dynamic behaviors, such as drag-and-drop or sophisticated visual tree structures. These libraries include the Dojo toolkit, Prototype, the Yahoo! User Interface library, and script.aculo.us. They are designed for developers who are already fairly well advanced in their JavaScript knowledge. These simple methods are changing as powerful tools proliferate for Ajax developers. The GWT takes a different approach to Ajax than most toolkits. Using the GWT framework, you can design and program your user interface using only the Java language. You can use the GWT's command-line tools to check the syntax of the Java classes, then automatically generate the JavaScript for the application's client-side. The design of the user interface is very similar to using Java's Swing API. You can thus view the GWT as a JavaScript-generation tool for Java programmers, as well as a framework for creating redistributable or extensible user-interface widgets. You do not have to know a lick of JavaScript, although you can include raw JavaScript in your code using special programming constructs that the GWT provides. The GWT's benefits include:
OK, enough of the high-level GWT discussion. Let's write a program and look at some code! |