美好的一天!我已经开始使用 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 dev 插件,但得到了相同的结果。
主入口点
...
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”的所有可能的重新绑定(bind)结果 重新绑定(bind) com.google.gwt.useragent.client.UserAgentAsserter 检查规则 [警告] 检测到与“com.google.gwt.editor.client.SimpleBeanEditorDriver”相关的警告。 validation-api-.jar 和validation-api--sources.jar 是否位于类路径上? 指定 -logLevel DEBUG 以查看所有错误。 [警告] 延迟绑定(bind)规则中指定了未知类型“com.google.gwt.editor.client.SimpleBeanEditorDriver”
一旦我运行应用程序,我就会从服务器收到以下消息:http://postimage.org/image/uf6lcczjb/
最佳答案
GWT4NB 插件似乎使用旧的 GWT 编译器类,这就是您收到警告的原因。不过,这应该不是问题。 404 错误表明缺少某些内容或者您将浏览器指向了错误的 URL。您的主机页面的名称必须与 URL 中的页面名称相匹配。由于您的主机页面名为 HelloGWT.html,因此请确保您打开的 URL 如下所示:
http://127.0.0.1:8080/HelloGWT.html
对于最终构建,我建议您使用 Ant 或 Maven。查看 GWT 官方文档 Compile and run in production mode和 Deploy a GWT Application .
关于gwt - 无法在 Netbeans 7 上运行 gwt hello world,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11758657/