Google Web Toolkit - GWT provides a set of development packages based on the Java language. The design of this development package refers to the Java AWT package design. Class naming rules, interface design, event listening, etc. are very similar to AWT. Developers familiar with Java AWT can quickly understand the GWT development kit without much effort, and spend more time in the development process of GWT applications.
The developed Java application will be compiled by the compilation tool provided by the GWT development package to generate the corresponding Web application with Ajax technology. The interaction between the Java application and the server will be replaced by the automatically generated asynchronous calling code.
GWT characteristics
GWT not only supports the transformation of applications developed in the Java language into Ajax applications, but also provides more advanced features. The following is a brief description of these features.
1. GWT compiler
The GWT compiler is the core of GWT and is responsible for translating Java code into Ajax content. The GWT compiler can translate most of the features of the Java language. It includes support for basic types and exception handling in the Java language, most classes and interfaces in the java.lang package and java.util package, regular expressions and serialization.
2. Cross platform support
If you use the display components (such as Button) and assembly components (such as VerticalPanel) provided in GWT, the Ajax applications compiled by GWT can support most browsers and operating systems, such as Internet Explorer, Firefox, etc., as well as different operating systems, such as Linux and Windows. This is because GWT maximizes the translation of these controls into browser built-in types. For example, the Button class is compiled to generate standard HTML.
GWT recommends using CSS to decorate the display effect of page elements. GWT classes rarely provide methods to access page element style attributes. We can directly set the default display effect of page elements through the corresponding style name in the CSS file. For example, use. gwt Button {font size: 150%;} to use the default display effect of Button elements.
3. Hosted Mode
Hosting mode refers to the state in which we interact with GWT applications that are not converted to Ajax applications. When we develop and debug, we are always in the host mode. In this case, the Java virtual machine uses the built-in browser of GWT to run the compiled class content of GWT applications, so it can provide the best speed for the "coding, testing, debugging" process.
We can run com. google. gwt. dev. GWTShell to start the hosting mode.
4. Web Mode
Web mode refers to the state that has been successfully converted to Ajax applications. In this state, we have begun to access Ajax applications through the Web.
When running in Web mode, GWT toolkit or JVM support is no longer required.
5. Command Line Tools
The GWT toolkit provides several useful gadgets to help us establish a GWT application development environment faster: projectCreator applicationCreator、junitCreator。
projectCreator
Create basic project files and optional Ant buildfile files required for developing GWT applications in Eclipse.
applicationCreator
The applicationCreator command is used to create a basic HelloWorld! Application and GWT application development environment.
junitCreator
Generate junti test code.
Through the above contents, we have learned the basic principles and main features of GWT toolset. I can't wait, so please join me in the process of GWT application development, and enjoy the simplicity and convenience of developing Ajax applications with Java language.
All environment preparation, instance development and instructions in this article are for the Windows operating platform. If you use other operating systems, please make appropriate adjustments according to the actual situation.