简体   繁体   English

Google Web工具包的空白页

[英]Blank page with Google Web Toolkit

I'm new with Google Web Toolkit. 我是Google Web Toolkit的新手。 I tried to create new project with NetBeans, and take Google Web Toolkit from Frameworks-list. 我尝试使用NetBeans创建新项目,并从Frameworks-list中获取Google Web Toolkit。 It works if I leave "org.yournamehere.Main" as GWT Module name. 如果我将“ org.yournamehere.Main”保留为GWT模块名称,则此方法有效。 But if I write something own there, all I can see is a blank html page with following source: 但是,如果我在那里写自己的东西,我所能看到的是一个空白的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>

I had the same problem when I start my first GWT RPC Hello-World application using NetBeans. 使用NetBeans启动我的第一个GWT RPC Hello-World应用程序时,我遇到了同样的问题。

Getting a blank page, you may want to check the following: 获取空白页,您可能需要检查以下内容:

  • WelcomeGWT.html (or index.html) under webpage folder 网页文件夹下的WelcomeGWT.html (或index.html)

Make sure the script source link is correct: 确保脚本源链接正确:

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

If you are using rename-to attribute check why does changing "module -> rename to" attribute in .gwt.xml file give error 如果使用重命名为属性,请检查为什么更改.gwt.xml文件中的“模块->重命名为”属性会导致错误


  • Web.xml file under Web-INF folder Web-INF文件夹下的Web.xml文件

Make sure the url-pattern is correct: 确保url模式正确:

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

To get a better idea of RemoteServiceRelativePath check Error 404 on GWT RPC 为了更好地了解RemoteServiceRelativePath,请检查GWT RPC上的错误404


  • Check your EntryPoint.java 检查您的EntryPoint.java

Sometimes it could be small mistakes, for example, 有时可能是小错误,例如,

forgetting to add the panel to the RootPanel. 忘记将面板添加到RootPanel。

OR 要么

the ID in your WelcomeGWT.html is misspelled 您的WelcomeGWT.html中ID拼写错误

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

Try; 尝试; (Replace {PROJECT_NAME} to your project name) (将{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>
....

I got it. 我知道了。 NetBeans made {PROJECT_NAME}.nocache.js file into wrong folder (My Documents\\NetBeansProjects\\ProjectName\\build\\web\\org.yournamehere.Main. There was line gwt.output.dir=/org.yournamehere.Main in gwt.properties.file. I fixed that and made "clean and build". NetBeans将{PROJECT_NAME} .nocache.js文件放到错误的文件夹中(我的Documents \\ NetBeansProjects \\ ProjectName \\ build \\ web \\ org.yournamehere.Main。在gwt.properties中有一行gwt.output.dir = / org.yournamehere.Main .file。我修复了该问题,并进行了“清理和构建”。

Good thing is that now I understand little bit more about GWT. 好消息是,现在我对GWT有了更多的了解。 Thanks anyway. 不管怎么说,还是要谢谢你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM