Html GWT StockWatcher示例应用程序--找不到CSS
对不起。这一定是第二双眼睛的东西之一,我就是找不到。我正在尝试学习GWT教程,它有一个假的“StockWatcher”应用程序,但它没有应用我的样式表,我不知道为什么 我正在使用eclipse(开普勒);我在Windows7上;我在eclipse中开发并运行它,应用程序确实运行了。现在,我正在讨论样式表可以为应用程序做些什么,它不仅没有看到样式表,而且似乎使用了另一个在我的计算机上找不到的样式表文件 我在Chrome中打开它,并使用“Inspect Element”。那里的窗口不支持多行选择,因此复制和粘贴将非常繁琐。只需说明Chrome中显示的HTML文件版本具有以下内容:Html GWT StockWatcher示例应用程序--找不到CSS,html,css,eclipse,gwt,Html,Css,Eclipse,Gwt,对不起。这一定是第二双眼睛的东西之一,我就是找不到。我正在尝试学习GWT教程,它有一个假的“StockWatcher”应用程序,但它没有应用我的样式表,我不知道为什么 我正在使用eclipse(开普勒);我在Windows7上;我在eclipse中开发并运行它,应用程序确实运行了。现在,我正在讨论样式表可以为应用程序做些什么,它不仅没有看到样式表,而且似乎使用了另一个在我的计算机上找不到的样式表文件 我在Chrome中打开它,并使用“Inspect Element”。那里的窗口不支持多行选择,因
<link type="text/css" rel="stylesheet" href="StockWatcher.css">
以下是eclipse运行配置的“程序参数”;显然,它们位于配置中的一行上: -服务器com.google.appengine.tools.development.gwt.AppEngineLauncher -remoteUI“${gwt\U remote\U ui\U server\U port}:${unique\U id}” -startupUrl StockWatcher.html -日志级别信息 -代码服务器端口9997-端口8888 -war C:\Users\rcook\workspaceKepler\StockWatcher\war com.google.gwt.sample.stockwatcher.stockwatcher
CSS文件位于项目的/war目录中。这是唯一需要的副本,也是您的应用程序将使用的唯一副本
在Eclipse中启动应用程序的方式一定有问题。打开您使用的运行配置。检查“参数”选项卡中/war目录的路径是否正确。我也遇到了同样的问题。我刚刚使用maven clean and install来更新资源,现在它可以工作了。我认为问题在于你的旧资源总是在你的项目中。我希望这能对你有所帮助 如何在Eclipse中运行项目?我已经在上面的原始文章中添加了运行配置。我还注意到:在Chrome中,我看到了错误的CSS文件副本,有一个我没有注意到的按钮叫做“导航”;当我点击它时,它会显示127.0.0.1:8888,在stockwatcher下面,在stockwatcher.css和stockwatcher.html?gwt.Codeserver=127.0.0.1:9997下面是文件(也就是说,这个导航看起来像一个文件选择器对话框)。如果我打开css,它是错误的,也就是说,它与我的项目源代码中的不匹配。有人知道它在哪里,以及如何更新吗?运行配置是正确的。您使用什么URL访问应用程序?确切地说,应该是肯定的。我使用GWT很多年了,我从来没有看到过这个问题。通常,您在CSS文件中进行更改,点击浏览器中的刷新按钮,就可以立即看到所有更改。没有缓存,任何地方都没有CSS文件的第二个副本。如果在调试模式或运行模式下启动它,有什么区别吗?看见
<!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>
/* Formatting specific to the StockWatcher application */
body {
padding: 10px;
}
/* stock list header row */
.watchListHeader {
background-color: #2062B8;
color: white;
font-style: italic;
}