简体   繁体   English

更改后不会刷新CSS

[英]CSS is not refreshed after change

Here is my simple (I hope) problem: 这是我的简单(我希望)问题:

I 'm running a web app with eclipse through tomcat 7. I use the classic servlet-model-jsp pattern. 我正在通过tomcat 7运行带有eclipse的Web应用程序。我使用经典的servlet-model-jsp模式。 My problem is when I change something in the stylesheet (CSS) and restart tomcat and reload the page on the chrome, the new css is not loaded on the browser (I check it through the browser and i see the same as before the changes). 我的问题是,当我在样式表(CSS)中更改某些内容并重新启动tomcat并在chrome上重新加载页面时,新的css未加载到浏览器上(我通过浏览器检查它,我看到与更改前相同) 。

What is wrong and what can i do about it?! 出了什么问题,我能做些什么呢?!

Thank you in advance :) 先感谢您 :)

I don't think this is a client issue. 我认为这不是客户问题。 I think it is a bug in Eclipse/ Tomcat plugin. 我认为这是Eclipse / Tomcat插件中的一个错误。 If you check the request.getPathTranslated() inside the servelet doGet method, it will be something like 如果你检查servelet doGet方法中的request.getPathTranslated() ,它会是这样的

C:\Users\YourName\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\
wtpwebapps\yourAppName\

So the tomcat running inside eclipse is serving up static content from there, which is different to the location of static content that you are editing, which is usually something like 所以在eclipse中运行的tomcat正在从那里提供静态内容,这与你正在编辑的静态内容的位置不同,这通常类似于

C:\fullPathTo\yourAppName\src\main\webapp\static

Tomcat inside eclipse often neglects to update the static content from where you have edited it to the plugins... spot from where it serves it to your web page. 日食中的Tomcat经常忽略将静态内容从你编辑它的地方更新到插件...从它为你的网页提供的位置。

To solve the problem I use Beyond Compare or similar, and set up a compare between the directories 为了解决这个问题,我使用Beyond Compare或类似的,并设置目录之间的比较

C:\fullPathTo\yourAppName\src\main\webapp\static

and

...\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\yourAppName\static

If css or other static changes (such as javascript files) fail to show up in the browser, just do a quick refresh of the Beyond Compare window, this will highlight the mismatches, copy them across manually, and you are good to go. 如果css或其他静态更改(例如javascript文件)无法在浏览器中显示,只需快速刷新Beyond Compare窗口,这将突出显示不匹配,手动复制它们,您就可以了。 I know this is a hack but it works for me, till the eclipse guys get this sorted out. 我知道这是一个黑客,但它适用于我,直到日食家伙得到这个整理。

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

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