Google News
logo
Java GWT Interview Questions
Google Web Toolkit (GWT) is a development toolkit for building ajax application using Java. GWT insist on reusable approaches to common web-app tasks such as bookmarking, UI abstraction, cross-browser portability, etc.
 
GWT provides two modes :
 
* Development Mode : It allows debugging the Java code of the application directly via the standard Java debugger.
* Web mode : In this, the application is translated into HTML and JavaScript code. It can be deployed to a web server.
It is one of the most important Java technologies with amazing features. Some cool features are :
 
* It provides excellent development tools like code refactoring, code navigation, etc. via eclipse.
* A single code base for client and server.
* It helps the server and client to quickly reloaded after making changes in it.
* In this, development tools are easy to install, for that, you need only two eclipse plugins.
* It supports IDE that helps with several coding tasks and errors.
* GWT generates a WAR file which makes easier for the deployment of applications.
* It provides a faster and reliable GUI layout.
* It also allows writing web applications offline, as it relies so little on the server.
Following are the core components of GWT :
 
GWT Java to JavaScript compiler : This is the most important part of GWT which makes it a powerful tool for building RIAs. The GWT compiler is used to translate all the application code written in Java into JavaScript.
 
JRE Emulation library : Google Web Toolkit includes a library that emulates a subset of the Java runtime library. The list includes java.lang, java.lang.annotation, java.math, java.io, java.sql, java.util and java.util.logging.
 
GWT UI building library : This part of GWT consists of many subparts which includes the actual UI components, RPC support, History management, and much more.
 
GWT Hosted Web Browser : GWT Hosted Web Browser lets you run and execute your GWT applications in hosted mode, where your code runs as Java in the Java Virtual Machine without compiling to JavaScript.
A GWT application consists of following four important parts out of which last part is optional but first three parts are mandatory :
 
* Module descriptors
* Public resources
* Client-side code
* Server-side code
A module descriptor is a configuration file used to set-up a GWT application. Its file extension is *.gwt.xml, where * is the name of the application and this file should reside in the project's root.
A GWT module is simply an encapsulation of functionality. It shares some similarities with a Java package but is not similar.
7 .
What is the purpose of 'inherits' tag in *.gwt.xml file in GWT?
This adds other gwt module in application just like import does in java applications. Any number of modules can be inherited in this manner.
8 .
What is the purpose of 'entry-point' tag in *.gwt.xml file in GWT?
This specifies the name of class which will start loading the GWT Application.
The GWT compiler recognizes the -ea flag to generate code for assertions in the compiled JavaScript. Only use assertions for debugging purposes, not production logic because assertions will only work under GWT's development mode.
By default, the class name for each component is gwt-. For example, the Button widget has a default style of gwt-Button, and similar way TextBox widget has a default style of gwt-TextBox.