GWT StockWatcher示例应用程序 - 找不到CSS

时间:2014-03-29 16:43:22

标签: html css eclipse gwt

对不起这必须是那些第二双眼睛之一,我只是没有找到它。我正在尝试通过具有假“StockWatcher”应用程序的GWT教程,并且它没有应用我的样式表,我不知道为什么。

我正在使用eclipse(开普勒);我在Windows 7上;我在eclipse中开发它并从那里运行它,应用程序运行。现在我正处理我们正在浏览样式表可以为应用程序做什么,它不仅看起来没有看到样式表,它似乎使用我在我的上找不到的不同样式表文件计算机。

我在Chrome中打开它,然后使用“Inspect Element”。那里的窗口不支持多行选择,因此复制和粘贴将非常繁琐。可以说Chrome中显示的HTML文件版本具有以下内容:

<link type="text/css" rel="stylesheet" href="StockWatcher.css">

我在网上看到关于关闭代码的警告,因此我在源代码中将其更改为“/&gt;”在末尾。我已经清理并构建它,并重新启动服务器,现在两次,但未显示的标签仍然出现在Chrome显示的HTML中。如何获取正在使用的HTML的更新版本?

在我纠正之前,Chrome的“检查元素”允许我打开StockWatcher.css,它的行与我放在那里的行不同。我在整个硬盘上搜索了另一个StockWatcher.css并没有找到一个; GWT构建是否制作了一个war文件,我必须做一些特殊的更新?

我尝试将HTML上的编码从UTF-8更改为UTF-16,但当我在inspect元素中查看时,它仍然(当然)说UTF-8。我想让更新版本的文件成为运行的文件是我的第一个问题...

我做错了什么?

这是HTML文件:

<!doctype html>
<!-- The DOCTYPE declaration above will set the     -->
<!-- browser's rendering engine into                -->
<!-- "Standards Mode". Replacing this declaration   -->
<!-- with a "Quirks Mode" doctype is not supported. -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

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

    <!--                                           -->
    <!-- THIS is fine                         -->
    <!--                                           -->
    <title>StockWatcher</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="stockwatcher/stockwatcher.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>

    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

    <!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
    <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>

    <h1>StockWatcher</h1>

    <div id="stockList">
    </div>
  </body>
</html>

这是StockWatcher.css本身:

/* Formatting specific to the StockWatcher application */

body {
  padding: 10px;
}

/* stock list header row */
.watchListHeader {
  background-color: #2062B8;
  color: white;
  font-style: italic;
}

以下是eclipse运行配置的“程序参数”;显然他们在配置中排在一行:

  

-server com.google.appengine.tools.development.gwt.AppEngineLauncher   -remoteUI“$ {gwt_remote_ui_server_port}:$ {unique_id}”   -startupUrl StockWatcher.html   -logLevel INFO   -codeServerPort 9997 -port 8888   -war C:\ Users \ rcook \ workspaceKepler \ StockWatcher \ war   com.google.gwt.sample.stockwatcher.StockWatcher

2 个答案:

答案 0 :(得分:1)

您的CSS文件位于项目的/ war目录中。这是唯一需要的副本,也是您的应用程序将使用的唯一副本。

在Eclipse中启动应用程序的方式肯定有问题。打开您使用的运行配置。检查Arguments选项卡中/ war目录的路径是否正确。

答案 1 :(得分:0)

我也遇到了同样的问题。我只是使用maven clean并安装来更新资源,现在它可以工作了。我认为问题是你的旧资源总是在你的项目中。我希望这可以帮到你。 :)

相关问题