Well, I eventually have to learn GWT, a matural web application framework published for 5 years.
Two weeks ago, my big boss, new architect, Bruce Lee (Lee Stroke, We call him Bruce Lee due to he has a nice face looks like Bruce Willis) asked me to take a look GWT after i finished the presentation of JBolt. Frankly speaking, i don't like HTML related technologies like jQuery, DWR, even EXT JS. I always have a concept that plain http based technologies are the critical issue which causes performance of desktop application decreases rapidly. But, considering popularizing jbolt platform, i decided to get start with GWT and to take a look what magic things it has.
1. Download GWT-2.0.3 from google offical website.
2. Unzip GWT-2.0.3
3. Read getting start document
4. Create my own application
In order to learn it quickly, i downloaded e-Book "GWT in Action" and went through chapter 1 "Getting Start". It just tells you to run command "applicationCreator" at first for setting up development environment. Unfortunately, it doesn't exist in version 2.0.3. Thus, don't be confused by book, just use command
webAppCreator -out MyWebApp jbolt.gwt.MyWebApp
to generate a number of files in folder "MyWebApp". If you are a wise man, you should take a look help information of command "webAppCreator". -out represents the path of output directory. In this case, i like to change it to "C:/Development/GWTProjects/MyWebApp". The following argument is used to specify the entry point class which can be regarded as a "main" class of GWT web application. I will introduce it later on.
After running this command, a project structure is constructed in "MyWebApp". Just as its names implied, "src" stores java source files, while "war" is a web root directory storing html related files such as html, css, js files, images, and WEB-INF directory.
After then, we can create a project in IDE. I hate learning a new framework with a specific IDE, especially eclipse. If you want to become a master, you should not rely on a specific IDE too much. Thus, i created a simple java project based on "MyWebApp" as a root directory. Likewise, i imported "war/WEB-INF/lib/gwt-servlet.jar" and "jsp-api.jar" as well as "servlet-api.jar" (You can find it in "%TOMCAT_HOME%/lib", if you have installed tomcat in your local environment) to dependencies.
Now, I have finished the preparation of first GWT application. According to the document, i chanaged directory to MyWebApp, and execute command
ant devmode
Obviously, it's a ant command. If you haven't installed ANT, please download it from apache website, and set corresponding path properly.
After running this command, a window appears on the screen. In the development mode window you will find the URL for the local server. Paste this URL into browser. You can see the first application.
Great! In the next part, i will detaily explain java source code of this application.