Skip to main content


developerWorks  >  XML | Web development | Java technology  >

Use XML to develop with the Google Web Toolkit

Build easy Ajax applications with the help of XML

developerWorks

Level: Intermediate

Nicholas Chase (ibmquestions@nicholaschase.com), Writer, Freelance
Tyler Anderson (tyleranderson5@yahoo.com), Writer, Freelance

10 Apr 2007

Register now or sign in using your IBM ID and password.

The Google Web Toolkit enables you to use Java™ syntax to create the JavaScript™ necessary for Asynchronous JavaScript + XML (Ajax) user interfaces. Most of these Ajax applications use XML to transfer information to and from the server, so your application must be able to both parse and create XML data. This tutorial shows you how to manipulate and create XML using the Google Web Toolkit.

In this tutorial

In the past couple of years, Ajax has practically become a requirement for new Web sites, but that doesn't make it any easier to create. To create Ajax-enabled sites manually means that you create JavaScript to make asynchronous HTTP requests using objects that do not comply with browser standards, which can make for a very long programming day. The Google Web Toolkit (GWT) abstracts the JavaScript tasks necessary for an Ajax-enabled application into a few Java classes, to make creating these interfaces much more intuitive for Java programmers. But most of these Ajax applications use XML to transfer information to and from the server, so your application must be able to both parse and create XML data.

Share this...

digg Digg this story
del.icio.us Post to del.icio.us
Slashdot Slashdot it!

This tutorial explains how to use XML with the GWT, a set of Java classes designed to make the creation of Ajax-enabled Web sites easier. You will build a very small, very simple mashup application, combining information from three different source as you learn how to send, receive, manipulate and create XML using the GWT.


Objectives

  • Review what Ajax, XML, and the Document Object Model (DOM) are

  • Learn what the GWT is

  • Create a GWT application

  • Retrieve an XML document using the GWT

  • Parse an XML document using the GWT

  • Manipulate a XML Document using the GWT

  • Send XML data using the GWT

Prerequisites

This tutorial assumes that you're familiar with Java concepts and with HTML, although the code is fairly simple. Familiarity with XML will be helpful, but we will provide a short introduction to XML and the Document Object Model (DOM). See Resources in the tutorial for some links to get you started.


System requirements

You will need JavaScript enabled in your browser.

To follow along with this tutorial, you will need to have the following tools installed:

  • Java 2 SE 1.4 or higher: The GWT uses Java classes to generate JavaScript, so you need to be able to compile them. You can download the Java Software Development Kit.
  • The GWT: The actual toolkit is available as a download from Google Code.
  • WinZip or another zip utility: You will need to decompress the GWT. You can download a trial version of WinZip.
  • An IDE such as Eclipse or IBM® Rational™ Web Developer will be helpful, but you can just as easily use a simple text editor to edit your files. You can download Eclipse at Eclipse.org or a trial version of Rational Web Developer.


Duration

1-2 hours





Formats

html, pdf


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed