2

良い一日!gwt 2.5 から始めました。NetBeans_7 に org-netbeans-modules-gwt4nb-2.10.5.nbm をインストールしました。GlassFish 3+ を使用して NetBeans_7 で簡単な gwt アプリ (ここにリンクの説明を入力) をビルドして実行した後、デフォルトのブラウザー (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>

次の警告が表示されます。

  1. GWT クライアント側コードのコンパイル。 警告: 「com.google.gwt.dev.GWTCompiler」は非推奨であり、将来のリリースで削除される予定です。代わりに「com.google.gwt.dev.Compiler」を使用してください。(この警告を無効にするには、 -Dgwt.nowarn.legacy.tools を JVM 引数として渡します。);
  2. com.google.gwt.useragent.client.UserAgentAsserter」の可能なすべての再バインド結果を計算しています 再バインド com.google.gwt.useragent.client.UserAgentAsserter .SimpleBeanEditorDriver'. クラスパスに validation-api-.jar と validation-api--sources.jar がありますか? すべてのエラーを表示するには、-logLevel DEBUG を指定します。 [警告]不明なタイプ 'com.google.gwt.editor.client.SimpleBeanEditorDriver' が遅延バインディング ルールで指定されました

アプリを実行するとすぐに、サーバーから次のメッセージが表示されます: http://postimage.org/image/uf6lcczjb/

4

2 に答える 2

1

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を確認してください。

于 2012-08-02T12:13:58.830 に答える
1

gwt.properties ファイルを開き、必要に応じて gwt.output.dir エントリを変更します (/ の後にエントリ gwt.module の値が続きます)。メツィアーノ

于 2012-08-04T14:22:50.847 に答える