provided by: 
Originally published at Internet.comJava Programming Notes # 2550 * Preface * General * Viewing tip * Figures * Listings * Supplementary material * General background information * Preview * Discussion and sample code * Run the programs * Summary * What's next? * Copyright * Download * Resources * About the author -----------------------------------
Preface
General
Development of Ajax web applications
Historically, the development of Ajax web applications has been a complex process. This is due mainly to the requirement to learn and use a variety of technologies, possibly including HTML, JavaScript, XML, ASP.NET, Java servlets, various scripting languages, etc.
Recently several products have emerged that make it possible to develop Ajax web applications using the Java development environment. Some use exclusively Java, while others use mainly Java.
The Google Web Toolkit (GWT)
One development environment that allows you to use mainly Java for the development of web applications is the Google Web Toolkit (GWT) (see Resources and Download).
Most of the client-side code for a GWT Ajax application can be written in Java. Apparently there is no requirement to write JavaScript code. However, it is necessary to: * Create an HTML host page for the application. * Create your own CSS style sheets. * Compile your Java code using a special GWT Java-to-JavaScript compiler. * Use a special scaled down version of the Java API, which only supports two packages from the standard J2SE API.
Not all standard Java packages are supported
The GWT only supports the following packages from the standard J2SE API: * java.lang * java.util
The GWT doesn't even fully support those two packages. For example, although the Vector class is supported by the GWT, only two overloaded constructors for that class are supported, whereas the Vector class in Sun's J2SE has four overloaded constructors.
Not based on the latest version of Java
In addition, the GWT version 1.1.10 is apparently based on version 1.4.2 of Sun's J2SE. Therefore, many of the features that were added in J2SE 5.0 (such as generics) are not supported by the GWT.
You need to be careful
Therefore, you need to be careful when writing your Java application to make certain that you are using only those Java features that are supported by the GWT. (See the link to the GWT JRE Emulation Library in Resources for more information on this topic.) First in a series This is the first lesson in a series of lessons designed to help yyou learn how to use the GWT to create rich Ajax web applications. Purpose of the tutorial The purpose of this tutorial lesson is to help you get your computer set up to create Ajax web applications using the GWT. Future lessons will concentrate on the Java programming techniques required to create more meaningful Ajax web applications. By the time you finish this tutorial, you should have your computer set up to create Ajax web applications, and you should have created and tested two basic applications. Prerequisites Knowledge of event-driven programming using the Java programming language as embodied in Sun's J2SE 5.0 (see DickBaldwin.com in Resources) is a prerequisite to understanding the material in this lesson. Knowledge of how to deploy a web application in a Java servlet container (see "Deployment of Web Applications in Jakarta Apache Tomcat 5" in Resources) is a prerequisite for being able to replicate the results produced in this lesson. System requirements
You will need to download and install the GWT framework (see Download).
You will need access to a servlet container for testing your web applications. One of the easiest ways to satisfy this requirement is to install a servlet container as a localhost server (see Download and also see "Getting Started with Jakarta Tomcat, Servlets, and JSP" in Resources).
Viewing tip
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures and listings while you are reading about them. You may also find it useful to open a third browser window at the Resources section near the end of the document. That will make it easy for you to open those resources when they are mentioned in the text.
Figures
* Figure 1. Three most useful items in the GWT framework. * Figure 2. The initial GWT development tree. * Figure 3. Screen output for the basic GWT web application. * Figure 4. Screen output after the button has been clicked. * Figure 5. Development tree after running GwtApp001-shell.cmd. * Figure 6. Expanded development tree showing compiler output. * Figure 7. The compiled application opened locally in a Firefox browser. * Figure 8. Development tree after creation of second web application. * Figure 9. Hosted mode screen output for second web application. * Figure 10. Development tree after compiling second application. * Figure 11. Tomcat server containing the files for two GWT applications.
Listings
* Listing 1. Java source code for the basic GWT web application. * Listing 2. Source code for program used to produce tree displays.
Supplementary material
I recommend that you also study the other lessons in my extensive collection of online Java tutorials. You will find a
Author: Richard G. Baldwin
Read article at Internet.com site