簡體   English   中英

Google Web工具包的空白頁

[英]Blank page with Google Web Toolkit

我是Google Web Toolkit的新手。 我嘗試使用NetBeans創建新項目,並從Frameworks-list中獲取Google Web Toolkit。 如果我將“ org.yournamehere.Main”保留為GWT模塊名稱,則此方法有效。 但是,如果我在那里寫自己的東西,我所能看到的是一個空白的html頁面,帶有以下源代碼:

<head>

    <meta name='gwt:module' content='vvv.test.module=vvv.test.module'>

    <title>moduuli</title>

</head>

<body>

    <script type="text/javascript"  src="vvv.test.module/vvv.test.module.nocache.js"></script>

</body>

使用NetBeans啟動我的第一個GWT RPC Hello-World應用程序時,我遇到了同樣的問題。

獲取空白頁,您可能需要檢查以下內容:

  • 網頁文件夾下的WelcomeGWT.html (或index.html)

確保腳本源鏈接正確:

src =“ org.yournamehere.ModuleName / org.yournamehere.ModuleName .nocache.js”

如果使用重命名為屬性,請檢查為什么更改.gwt.xml文件中的“模塊->重命名為”屬性會導致錯誤


  • Web-INF文件夾下的Web.xml文件

確保url模式正確:

<servlet-name>ServerSideServiceImpl</servlet-name>
<url-pattern>/org.yournamehere.ModuleName/RemoteServiceRelativePath</url-pattern>

為了更好地了解RemoteServiceRelativePath,請檢查GWT RPC上的錯誤404


  • 檢查您的EntryPoint.java

有時可能是小錯誤,例如,

忘記將面板添加到RootPanel。

要么

您的WelcomeGWT.html中ID拼寫錯誤

RootPanel.get(“ gwtContainer ”).add(panel);

嘗試; (將{PROJECT_NAME}替換為您的項目名稱)

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <!-- <meta name="gwt:property" content="locale=tr"> -->

    <!--                                                               -->
    <!-- Consider inlining CSS to reduce the number of requested files -->
    <!--                                                               -->
    <link type="text/css" rel="stylesheet" href="{PROJECT_NAME}.css">

    <!--                                           -->
    <!-- Any title is fine                         -->
    <!--                                           -->
    <title>{TITLE}</title>

    <!--                                           -->
    <!-- This script loads your compiled module.   -->
    <!-- If you add any GWT meta tags, they must   -->
    <!-- be added before this line.                -->
    <!--                                           -->
    <script type="text/javascript" language="javascript" src="{PROJECT_NAME}/{PROJECT_NAME}.nocache.js"></script>
  </head>

  <!--                                           -->
  <!-- The body can have arbitrary html, or      -->
  <!-- you can leave the body empty if you want  -->
  <!-- to create a completely dynamic UI.        -->
  <!--                                           -->
  <body>
....

我知道了。 NetBeans將{PROJECT_NAME} .nocache.js文件放到錯誤的文件夾中(我的Documents \\ NetBeansProjects \\ ProjectName \\ build \\ web \\ org.yournamehere.Main。在gwt.properties中有一行gwt.output.dir = / org.yournamehere.Main .file。我修復了該問題,並進行了“清理和構建”。

好消息是,現在我對GWT有了更多的了解。 不管怎么說,還是要謝謝你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM