Before you start
This tutorial, the first in a two-part series, is for Java developers who want to create Ajax-enabled Web applications and learn about the GWT and Apache Geronimo.
Ajax-enabled Web applications have become incredibly popular recently. Ajax makes Web applications behave a lot like desktop applications. They offer greater interactivity and functionality than the previous generation of Web applications. And Geronimo provides the perfect platform for building Ajax-enabled Web applications.
However, building Ajax-enabled Web applications is more difficult than building traditional Web applications. It involves lots of JavaScript and Dynamic HTML (DHTML) development. Quirks among different browsers—and even different versions of the same browser—further complicate things. The GWT is one of many Ajax frameworks that makes your job easier by using a novel approach that lets you write all of your code in the Java language and generates all the JavaScript for you. The two tutorials in this series cover the following topics:
- Part 1 focuses on getting started with GWT and creating a simple Ajax-enabled Web application for retrieving stock quotes.
- Part 2 shows you how to make the stock quotes application more sophisticated and how to transform it into a stock portfolio application, leveraging both GWT and Geronimo.
In this tutorial, you build an Ajax-enabled Web application using the GWT and find out how easy it is to develop GWT applications and deploy them using Geronimo.
This tutorial covers:
- Installing GWT.
- Using GWT's command-line tools.
- Programmatic UI development using GWT's widgets.
- Creating an Ajax-enabled service called by your Web application.
- Building and deploying the application using Geronimo.
This tutorial is about building a Java Web application, but you'll only need to understand the basics of Java servlets. GWT leverages many ideas common to other technologies, such as layout management, event systems, and remote procedural calls (RPCs), so prior exposure to these ideas makes it easy to master GWT. You'll also work with the Geronimo Console, HTML, and cascading style sheets (CSS), so some familiarity with these tools is helpful.
You need the following software to set up your development environment before getting started:
- Geronimo 2.0 with Tomcat — The sample Web application in this tutorial was built using Geronimo with Tomcat, but it should also work with Geronimo with Jetty, because everything is standard Java Platform, Enterprise Edition (Java EE). This tutorial uses Geronimo 2.0 (M3) but should work with older versions of Geronimo as well.
- Java 5 or Java 6 — The sample Web application uses generics and annotations. It was developed using Java 6, but also tested against Java 5.
- Apache Jakarta implementation of JSTL 1.1 — Geronimo 1.1 is a certified J2EE 1.4 implementation, so you need to use JSTL 1.1.
- Google Web Toolkit — This tutorial is all about the GWT; download GWT 1.3.3 for this tutorial.
- Eclipse — The sample Web application is built using Eclipse, as you'll see from the screen captures. GWT includes a convenient command-line tool for creating a skeleton Eclipse project. It's not hard to build GWT applications without Eclipse, but Eclipse provides a great debugger to debug your GWT application.
To get started with GWT, you first need to install it. When you go to the GWT download page, it presents you with a GWT distribution that is specific to your operating system. That's because GWT includes several command-line executables for generating artifacts needed for your application. Some of the artifacts that it creates include executables for running the GWT Java-to-JavaScript compiler and for running your application in hosted mode.
After you've downloaded GWT, extract it and navigate to the directory where you extracted it. You should see files similar to those in Figure 1.
Figure 1. GWT installation directory
Notice the executable files, such as applicationCreator.cmd and projectCreator.cmd. You use these to generate your application and an Eclipse project for your application. You might also want to create an environment variable — GWT_HOME for example. The tutorial refers to this variable.
That's all there is to installing GWT! No installers to run or anything like that. Just extract the archive, and you're ready to start building a Web application using GWT.


