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

标签 html css eclipse gwt

对不起。这一定是那些第二双眼睛的东西之一,我只是没有找到它。我正在尝试浏览具有虚假“StockWatcher”应用程序的 GWT 教程,但它没有应用我的样式表,我不知道为什么。

我正在使用 eclipse(开普勒);我在 Windows 7 上;我在 eclipse 中开发它并从那里运行它,应用程序确实运行了。现在我正在研究样式表可以为应用程序做什么,它不仅没有看到样式表,而且似乎使用了一个我在我的网站上找不到的不同样式表文件电脑。

我在 Chrome 中打开它,并使用“Inspect Element”。那里的窗口不支持多行选择,所以复制粘贴会很繁琐。只需说 Chrome 中显示的 HTML 文件版本具有以下内容:

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

我在网上看到关于关闭标签的警告,所以我在源代码中将其更改为末尾有“/>”。我已经清理并构建了它,并重新启动了服务器,现在两次,但未关闭的标签仍然出现在 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

最佳答案

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

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

关于html - GWT StockWatcher 示例应用程序——找不到 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22733800/

相关文章:

java - 我如何强制方法的实现在 Java 中的 try-catch block 中?

svg 的 css 故障效果不适用于 chrome

css - 浏览器/网络邮件客户端中的默认打印样式

eclipse - 多个镜像的 maven 设置

html - prev 和 Next 按钮并排出现,而不是出现在边缘。

html - css 边框未应用于表 tr

java - intellij idea默认如何排序导入?

PHP如果我想回显表而不是foreach循环我该怎么办

html - 在深色播放器中嵌入YouTube视频?

javascript - 更改链接颜色 onclick 而不使用 PreventDefault()