获取Eclipse来识别Spring MVC项目中通过上下文包含的CSS [英] Get Eclipse to recognise CSS included via context in Spring MVC project
问题描述
我已经阅读了许多将CSS包含到Spring MVC项目中的方法,并且将它们部署到服务器上后,它们都可以很好地加载:
I've read many different ways to include CSS into a Spring MVC project and they all load fine when deployed onto a server:
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet">
<link href="<c:url value='/css/style.css' />" rel="stylesheet">
<link href="/MyApp/css/style.css" rel="stylesheet">
但是,除非我提供相对路径(例如 ../../css/style.css
),否则Eclipse似乎不太满意,但是部署时该路径显然不会加载.如果使用上述三种方法中的任何一种,则路径下方都会出现一条红色的波浪线,并显示以下错误:
However, it seems Eclipse is not too happy unless I provide a relative path (eg. ../../css/style.css
) but that path will obviously not load when deployed. If I use either of the three methods above, I get a red wavy line below the path with the error:
Undefined CSS file ("${pageContext.request.contextPath}/css/style.css").
该样式表中使用的所有类也将出现类似的错误:
All the classes used from that stylesheet will also have a similar error:
Undefined CSS class (class-name).
我丢失了某些东西吗?还是我必须忍受这个东西并关闭警告?
Am I missing something or do I have to live with this and turn off the warnings?
推荐答案
我也遇到了这个问题,并且发现在githib上的Eclipse WTP Webresources项目中报告了一个错误:
I too experienced this problem, and found a bug has been reported in the eclipse WTP Webresources project on githib:
https://github.com/angelozerr/eclipse-wtp-webresources/Issues/37
如果/如果解决此问题,我们烦人的红色波浪线将成为过去!
If/When this is fixed, our annoying red squiggly lines will be a thing of the past!
这篇关于获取Eclipse来识别Spring MVC项目中通过上下文包含的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!