简体   繁体   中英

Blank page with Google Web Toolkit

I'm new with Google Web Toolkit. I tried to create new project with NetBeans, and take Google Web Toolkit from Frameworks-list. It works if I leave "org.yournamehere.Main" as GWT Module name. But if I write something own there, all I can see is a blank html page with following source:

<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.

Getting a blank page, you may want to check the following:

  • WelcomeGWT.html (or index.html) under webpage folder

Make sure the script source link is correct:

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


  • Web.xml file under Web-INF folder

Make sure the url-pattern is correct:

<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


  • Check your EntryPoint.java

Sometimes it could be small mistakes, for example,

forgetting to add the panel to the RootPanel.

OR

the ID in your WelcomeGWT.html is misspelled

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

Try; (Replace {PROJECT_NAME} to your 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".

Good thing is that now I understand little bit more about GWT. Thanks anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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