2012-04-03 7 views
0

방금 ​​GWT로 시작했습니다. 튜토리얼을 here으로 지정했습니다. 그러나 새 프로젝트를 만들고 가로 패널에 두 개의 버튼을 추가 한 다음 RootPanel에서 HTML 파일에서 만든 머리글 만 표시했습니다. 이유가 무엇인지 말해 줄 수 있어요? 자바 클래스 : 다음은 자바 클래스는 HTML과 XML입니다새 GWT 앱의 버튼

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

어떻게 프로젝트를 시작 했습니까? 환경을 코딩 할 때 이클립스를 사용하고 있습니까? – 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

브라우저에서 개발자 콘솔을여십시오. 웹 요청을 추적 할 수 있어야합니다. * nocache.js 파일이 호출되고 다시 확인 (상태 200)되는지 확인하십시오.

괜찮 았으면 아무 것도 분명하지 않습니다. 어쩌면로드 할 div 지정하지 않으려 고?

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

javascript가 호출되고 있지만 콘솔에 다음 오류가 나타납니다. Uncaught TypeError : "정의되지 않은 '__gwt_getProperty'속성을 설정할 수 없습니다. 해당 코드 줄 뒤에 추가됩니다 : "function B() {if (p && q 구원 = null; c.gwtOnLoad()()()() {} " – malkoto1

+0

그게 전부 야.");}}}}}}}} 시각적으로 디버깅하기 어려울 수있는 생성 된 js. Eclipse 또는 Eclipse에서 Tomcat 서버를 실행하고 있습니까? –

+0

Eclipse의 개발 모드를 사용하고 있습니다. – malkoto1