问题描述
我有一个Servlet/JSP Webapp.因此,现在在将NetBeans指向我的style.css文件时遇到了麻烦.如果将样式表放置在WEB-INF或META-INF中,或放置在Web页目录的外部,则一切正常.但是我需要将此文件存储在src/main/resources/css/style.css下的css文件夹中问题是我无法引用style.css,因为它不在Web页目录下.
I have a Servlet/JSP webapp. So now I am having troubles in pointing NetBeans to my style.css file. If stylesheet is being placed in WEB-INF or META-INF or outside them in Web Pages dir - everything works fine. But I need to store this file in a css folder under src/main/resources/css/style.cssThe problem is that I can't refer to style.css is it is outside Web Pages dir.
推荐答案
仅由于客户端无法访问该文件夹以外的所有内容,因此无法将css文件放置在pages文件夹之外.不要忘记这样包含一个css文件:
You cannot place a css file outside the pages folder simply because everything exept that folder is not accessible by the Client. Dont forget that a css file is included like this:
<link rel="stylesheet" type="text/css" href="css/notification.css" />
您不希望有人将其更改为< link rel ="stylesheet" type ="text/css" href ="../src/MyPreciousJavaFile.java"/>
获取其他文件的编码.
You dont want someone to change it to <link rel="stylesheet" type="text/css" href="../src/MyPreciousJavaFile.java" />
and simply get the coding of any other file.
这篇关于NetBeans没有看到style.css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!