2012-04-03 11 views
0

GWTを使い始めました。チュートリアルをhereとしました。しかし、私は新しいプロジェクトを作成し、水平パネルに2つのボタンを追加し、RootPanelでHTMLファイルで作成したヘッダだけを表示しました。理由が何であるか教えていただけますか?ここで は、Javaクラスで、HTMLとXML: Javaクラス:新しいGWT Appのボタン

package org.elsys.salvation.client; 

import com.google.gwt.core.client.EntryPoint; 
import com.google.gwt.user.client.ui.Button; 
import com.google.gwt.user.client.ui.HorizontalPanel; 
import com.google.gwt.user.client.ui.Label; 
import com.google.gwt.user.client.ui.RootPanel; 


public class Salvation implements EntryPoint { 

    private Button newData = new Button("New"); 
    private Button existingData = new Button("Existing"); 
    private HorizontalPanel mainHorizontalPanel = new HorizontalPanel(); 
    private Label lastUpdatedLabel = new Label(); 

    public void onModuleLoad() { 
     mainHorizontalPanel.add(newData); 
     mainHorizontalPanel.add(existingData); 
     mainHorizontalPanel.add(lastUpdatedLabel); 

     RootPanel.get("Salvation").add(mainHorizontalPanel); 
    } 

} 

HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
    <head> 
     <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
     <link type="text/css" rel="stylesheet" href="Salvation.css"> 
     <title>Diploma Defences Organiser</title> 
     <script type="text/javascript" language="javascript" src="stockwatcher/stockwatcher.nocache.js"></script> 
    </head> 
    <body> 

     <h1>Diploma Defences Organiser</h1> 
     <div id="Salvation"></div> 
     <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> 
     <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> 

とXML:

<?xml version="1.0" encoding="UTF-8"?> 
<module rename-to='Salvation'> 
    <!-- 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.       --> 
    <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='org.elsys.salvation.client.Salvation'/> 

    <!-- Specify the paths for translatable code     --> 
    <source path='client'/> 
    <source path='shared'/> 

</module> 
+0

プロジェクトをどのように開始しましたか?環境をコーディングするときにeclipseを使用していますか? – Stefan

+0

はい、日食: – malkoto1

答えて

0

がそれかどうか、この行をチェックしてください正しいかどうか:

<script type="text/javascript" language="javascript" src="stockwatcher/stockwatcher.nocache.js"></script> 

私はあなたのようなものがあると思う:Salvation/Salvation.nocache.jsスクリプトタグのソースとして。

+0

私はそれを修正しましたが、ヘッダーだけが表示されています... – malkoto1

+0

@ malkoto1 .nocache.jsファイルがそのURLからアクセス可能であることを確認すると、nocache.jsファイルがそのページから利用可能な場合に動作するはずです。 ... –

0

ご使用のブラウザでは、開発者コンソールを開きます。行われたWebリクエストを追跡できるはずです。 * nocache.jsファイルが呼び出され、ok(Status 200)に戻ってきていることを確認してください。

それがうまくいけば何も私に明白に飛び出します。おそらくあなたがロードしたいdivを指定しないでください?

RootLayoutPanel.get().add(mainHorizontalPanel); 
+0

javascriptが呼び出されていますが、コンソールに次のエラーが表示されます。Uncaught TypeError: "未定義のプロパティ '__gwt_getProperty'を設定できません。そのコード行の後ろに追加されます: " function B(){if(p && q救済= null; c.gwtOnLoad(){}}}}}}}}} "); – malkoto1

+0

これは(つまり、私はあなたのウェブサイトに)視覚的にデバッグするのが難しいjsを生成します。 eclipseでコンパイルしたTomcatサーバーから実行していますか? –

+0

私はEclipseの開発モードを使用しています。 – malkoto1

関連する問題