名称 | 位置 |
项目根 | HelloWorld/ |
模块描述符 | src/com/tutorialspoint/HelloWorld.gwt.xml |
公共资源 | src/com/tutorialspoint/war/ |
客户端代码 | src/com/tutorialspoint/client/ |
服务端代码 | src/com/tutorialspoint/server/ |
<?xml version = "1.0" encoding = "utf-8"?> <module rename-to = 'helloworld'> <!--inherit the core web toolkit stuff. --> <inherits name = 'com.google.gwt.user.user'/> <!--inherit the default gwt style sheet. --> <inherits name = 'com.google.gwt.user.theme.clean.Clean'/> <!--specify the app entry point class. --> <entry-point class = 'com.tutorialspoint.client.HelloWorld'/> <!--specify the paths for translatable code --> <source path = '...'/> <source path = '...'/> <!--specify the paths for static files like html, css etc. --> <public path = '...'/> <public path = '...'/> <!--specify the paths for external javascript files --> <script src = "js-url" /> <script src = "js-url" /> <!--specify the paths for external style sheet files --> <stylesheet src = "css-url" /> <stylesheet src = "css-url" /> </module>
节点和描述 |
<module rename-to="helloworld">
这提供了应用程序的名称。
|
<inherits name="logical-module-name" />
这会在应用程序中添加其他 gwt 模块,就像在 java 应用程序中所做的一样。可以通过这种方式继承任意数量的模块。
|
<entry-point class="classname" />
这指定将开始加载 GWT 应用程序的类的名称。可以添加任意数量的入口点类,并按照它们在模块文件中出现的顺序依次调用它们。所以当你的第一个入口点的 onModuleLoad() 完成时,下一个入口点会立即被调用。
|
<source path="path" />
这指定了 GWT 编译器将搜索源编译的源文件夹的名称。
|
<public path="path" />
公共路径是项目中 GWT 模块引用的静态资源(例如 CSS)所在的位置或图像,被存储。默认公共路径是存储模块 XML 文件的公共子目录。
|
<script src="js-url" />
自动注入位于 src 指定位置的外部 JavaScript 文件。
|
<stylesheet src="css-url"/>
自动注入位于 src 指定位置的外部 CSS 文件。
|
<html> <head> <title>Hello World</title> <link rel = "stylesheet" href = "HelloWorld.css"/> <script language = "javascript" src = "helloworld/helloworld.nocache.js"> </script> </head> <body> <h1>Hello World</h1> <p>Welcome to first GWT application</p> </body> </html>
body {
text-align: center;
font-family: verdana, sans-serif;
}
h1 {
font-size: 2em;
font-weight: bold;
color: #777777;
margin: 40px 0px 70px;
text-align: center;
}
public class HelloWorld implements EntryPoint { public void onModuleLoad() { Window.alert("Hello, World!"); } }