GWT工程架构详解
通过GAE(Google App Engin)新建一个GWT工程,会得到如下的结构:
目录结构说明如下:
1) sc目录存放源代码;
2) client目录存放的是UI代码,即界面代码,会被编译成JavaScript代码嵌入页面进行调用;
3) server目录存放的是服务端代码;
4) shared目录存放的是页面校验代码,会被编译成JavaScript代码;
5) test目录存放的是测试代码;
6) war存放的是发布信息。
包名的根目录下gwt.xml文件说明:
<?xml version="1.0" encoding="UTF-8"?> <!-- When updating your version of GWT, you should also update this DTD reference, so that your app can take advantage of the latest GWT module capabilities. --> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd"> <!-- rename-to重命名:使用了rename-to='testgae' 编译后的GWT信息会存放到testgae文件夹下, 如果没有使用rename-to='testgae' 编译后的GWT信息则会存放到带包命名的文件下,如com.test 下面。--> <module rename-to='testgae'> <!-- 每一个GWT工程都必须继承com.google.gwt.user.User,这是核心 --> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.User'/> <!-- Inherit the default GWT style sheet. You can change --> <!-- the theme of your GWT application by uncommenting --> <!-- any one of the following lines. --> <!-- 为本GWT应用指定风格,有标准的也有 Chrome 浏览器的。--> <inherits name='com.google.gwt.user.theme.clean.Clean'/> <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <!-- Other module inherits --> <!-- Specify the app entry point class. --> <entry-point class='com.test.client.TestGAE'/> <!-- Specify the paths for translatable code --> <source path='client'/> <source path='shared'/> </module>