Google Web ToolKit(GWT)

Introduction : AJAX applications with Frameworks

Normally an Ajax application is built by creating XHTML pages and JavaScript code with a suitable integrated development environment (IDE). 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. They are designed for developers who are already fairly well advanced in their JavaScript knowledge. The GWT takes a different approach to Ajax than most toolkits. These simple methods are changing as powerful tools proliferate for Ajax developers.

Google Web Toolkit – An Overview

The Google Web Toolkit (GWT) is a revolutionary way to build Asynchronous JavaScript and XML (AJAX) applications that are comparable in responsiveness and look and feel to desktop applications. Google Web Toolkit (GWT) is an open source Java development framework that lets you escape the matrix of technologies that make writing AJAX applications so difficult and error prone. With GWT, you can develop and debug AJAX applications in the Java language using the Java development tools of your choice. On deployment, the GWT compiler translates your Java application to browser-compliant JavaScript and HTML.

How is GWT different from other Frameworks?

GWT provides a set of ready-to-use user interface widgets that you can immediately utilize to create new applications. It also provides a simple way to create innovative widgets by combining the existing ones. You can use the Eclipse IDE to create, debug, and unit-test your AJAX applications. You can build RPC services to provide certain functionalities that can be accessed asynchronously from your web applications easily using the GWT RPC framework.
GWT enables you to integrate easily with servers written in other languages, so you can quickly enhance your applications to provide a much better user experience by utilizing the AJAX framework. GWT has the Java-to-JavaScript compiler to distill your application into a set of JavaScript and HTML files that you can serve with any web server. This gives us a great feature browser compatibility.

GWT Architecture

There are four major components with which the GWT is built. They are

  • a Java-to-JavaScript compiler
  • a “hosted” web browser
  • two Java class libraries (one the JAVA API and another GWT API)

GWT Java-to-JavaScript Compiler

You use the GWT compiler to compile your GWT applications to JavaScript. The application can then be deployed to a web container. This is referred to as running in web mode. When you click on the Compile/Browse button, the Java code for the project is compiled by the Java-to-JavaScript compiler into pure HTML and JavaScript. The resulting artifacts are copied automatically to the Project/www folder.

GWT Hosted Web Browser

This enables you to run and execute your GWT applications as Java in the Java Virtual Machine (JVM) without compiling to JavaScript first. This is referred to as running in hosted mode. GWT accomplishes this by embedding a special SWT browser control that contains hooks into the JVM. This special browser utilizes an Internet Explorer control on Windows or a Mozilla control on Linux. When you run the Project, the embedded SWT browser is what you see displaying the application.

JRE emulation library

This contains JavaScript implementations of most of the widely used classes of the java.lang and java.util packages from the Java standard class library. Only some of the commonly used classes from these two packages are supported. None of the other Java packages in the JDK are currently part of this emulation library. These are the only classes that can be used by you for the client side of the AJAX application. You are of course free to use the entire Java class library for the server-side implementation. The Java code in the project is compiled into JavaScript using this emulation library.

GWT Web UI class library

This provides a set of custom interfaces and classes that enable you to create various widgets such as buttons, text boxes, images, and text. GWT ships with most of the widgets commonly used in web applications. This is the class library that provides the Java widgets.

Comments

comments

Pages: 1 2

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*