【发布时间】:2012-08-01 11:55:38
【问题描述】:
美好的一天!我从 gwt 2.5 开始。我已经在 NetBeans_7 上安装了 org-netbeans-modules-gwt4nb-2.10.5.nbm。在我使用 GlassFish 3+ 在 NetBeans_7 中构建并运行了一个简单的 gwt 应用程序 (enter link description here) 后,默认浏览器 (firefox_14) 启动了相应的页面并输出空页面。有什么问题?我还在 firefox_14 上安装了 gwt 开发插件,但我得到了相同的结果。
主入口点
...
public class MainEntryPoint implements EntryPoint {
/**
* Creates a new instance of MainEntryPoint
*/
public MainEntryPoint() {
}
/**
* The entry point method, called automatically by loading a module that
* declares an implementing class as an entry-point
*/
@Override
public void onModuleLoad() {
final Label label = new Label("Hello, GWT!!!");
final Button button = new Button("Click me!");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
label.setVisible(!label.isVisible());
}
});
RootPanel.get().add(button);
RootPanel.get().add(label);
}
}
...
HelloGWT.html
<!doctype html>
<!--
The DOCTYPE declaration above will set the browser's rendering engine into
"Standards Mode". Replacing this declaration with a "Quirks Mode" doctype may
lead to some differences in layout.
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name='gwt:module' content='gwt.intro.Main=gwt.intro.Main'>
<title>Main</title>
</head>
<body>
<script type="text/javascript" src="gwt.intro.Main/gwt.intro.Main.nocache.js"></script>
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
</body>
</html>
我收到以下警告:
- GWT 编译客户端代码。 警告:“com.google.gwt.dev.GWTCompiler”已弃用,将在未来的版本中删除。 请改用“com.google.gwt.dev.Compiler”。 (要禁用此警告,请将 -Dgwt.nowarn.legacy.tools 作为 JVM 参数传递。);
- 计算“com.google.gwt.useragent.client.UserAgentAsserter”的所有可能的重新绑定结果 重新绑定 com.google.gwt.useragent.client.UserAgentAsserter 检查规则 [WARN] 检测到与“com.google.gwt.editor.client.SimpleBeanEditorDriver”相关的警告。类路径上是否有validation-api-.jar 和validation-api--sources.jar? 指定 -logLevel DEBUG 以查看所有错误。 [WARN] 在延迟绑定规则中指定了未知类型“com.google.gwt.editor.client.SimpleBeanEditorDriver”
我一运行应用程序,就会从服务器收到以下消息:http://postimage.org/image/uf6lcczjb/
【问题讨论】:
-
你的应用在做什么?你能告诉我们EntryPoint类吗?确保向 RootPanel 添加一些内容。
-
是的。我不带参数调用 RootPanel(因此,这个包装了 元素)并向面板添加标签和按钮:pastie.org/4376291
-
EntryPoint 类和您的主机页面在我看来确实不错。您是否在编译期间或启动开发模式时检查是否有任何错误?如果一切正常,开发模式应该会给你一个“模块加载”的消息。
-
我已经编辑了我的消息并指出了我从编译器收到的所有警告。
标签: gwt netbeans-7