Chapter 2. Getting Started


First, a few prerequisites. You need an installed Java Development Kit (JDK) of version 1.4 or later. As of this writing, using GWT distribution gwt-mac-1.2.22, you cannot use the Java 5 features such as generics or autoboxing with your client-side code, but you can certainly use the Java 5 JDK compiler as you write these classes.

NOTE

The GWT developers released GWT Release Candidate (RC) 1.3 at the time we published this shortcut. This release is associated with the GWT open-source announcement, however, and did not provide any new functionality. The demo application was compiled and tested with gwt-mac-1.3.1 RC and the official gwt-mac-1.2.22 release.

You have to download and unpack the GWT framework. The download address is http://code.google.com/webtoolkit. You can download the framework for Windows, Linux, or Mac OS X.

The unpacked archive includes:

  • Documentation, including a Javadoc format for the GWT API classes;

  • The Java Archive (JAR) file (gwt-user.jar) containing the user interface classes and other parts of the GWT API (such as modules for handling JSON and XML formats, and making HTTP requests from your client code);

  • The JAR file (e.g., gwt-dev-mac.jar) containing GWT's proprietary development tools, such as the Java classes that "compile" your code and generate JavaScript;

  • The JAR file (gwt-servlet.jar) that you can deploy to Tomcat or other servlet containers, and that includes the GWT API for the user-interface widgets and other objects. This is essentially gwt-user.jar without the Servlet API classes from the javax package. The Java Servlet Specification, an accepted standard for servlet containers, does not allow packages such as javax.servlet to be loaded from JARs in particular web applications. Therefore, gwt-servlet.jar can be placed in WEB-INF/lib inside your Java web applications if your server-side code requires the GWT classes to be present on the application's classpath.

  • A number of command-line interface tools (see below).

NOTE

You do not need to include the gwt-servlet.jar file in your Java web application's classpath unless you have server-side classes that use the GWT API, such as the Remote Procedure Call (RPC) related classes and interfaces. This is because the GWT user interface-related Java API is only used in development, before the GWT tools or compilers generate the JavaScript. You then deploy just the generated JavaScript to your web application. The JavaScript is eventually executed inside the browser and no longer has any relation to the GWT Java API (and associated JAR file). By then, it's just JavaScript!

Now we're almost ready to start coding.




Google Web Toolkit for Ajax
Google Web Toolkit GWT Java AJAX Programming: A step-by-step to Google Web Toolkit for creating Ajax applications fast
ISBN: 1847191002
EAN: 2147483647
Year: 2006
Pages: 29

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net