GWT is a framework recently launched by Google to develop Ajax applications. It enables programmers to develop client and server code simultaneously in Java.
The GWT compiler converts the Java code used for developing the client into Javascript and Html, and the programmer does not need to care about this conversion process. In this way, programmers can develop their own Ajax applications in their favorite Java IDE.
GWT features
1. Dynamic and reusable UI Components
The component library provided by GWT enables users to easily develop beautiful UIS. Each component corresponds to a class of GWT. In the second part of this article, we will introduce in detail how GWT supports the UI.
2. Simple RPC call
With GWT, you can easily implement communication between the client and the server, especially making asynchronous communication quite simple. The later part of this article will introduce in detail the RPC call using GWT.
3. More convenient debugging
Because HTML section is not generated during the development phase, the code developed by the user is actually run on the JVM, so that the user can debug the program using the traditional Java code debugging method, this speeds up debugging and reduces the time required for software development.
4. browser compatibility
In most cases, programs developed with GWT support IE, Firefox, Mozilla, Safari, and Opera. users do not have to worry about browser compatibility during development. The compatibility of browsers is another tricky problem for programmers who use Javascript For Ajax application development.
5. scalability
If you think the APIS provided by GWT cannot meet your needs, you can use JSNI to directly embed Javascript statements into Java code.
Use GWT for UI development
In this section, we will discuss the support of GWT for UI development. GWT contains most of the components required for Web development, such as buttons and Text boxes. Figure 1 shows some UI components supported by GWT. From the image display effect, GWT can be used to make a very beautiful UI.
Figure 1: Some UI components supported by GWT
It is worth mentioning that each UI component must be placed in a control called Panel. The Panel has different styles, which also determines the UI style. Figure 2 shows some panels supported by GWT.
Figure 2: Some panels supported by GWT
After reading these components, we will use an experiment to describe how to add the UI components to the page. The final result of this experiment is a logon window.