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.css The problem is that I can't refer to style.css is it is outside Web Pages dir.
9099 次
2 に答える
3
クライアントがそのフォルダー以外のすべてにアクセスできないという理由だけで、css ファイルを pages フォルダーの外に配置することはできません。css ファイルが次のように含まれていることを忘れないでください。
<link rel="stylesheet" type="text/css" href="css/notification.css" />
誰かがそれを変更して<link rel="stylesheet" type="text/css" href="../src/MyPreciousJavaFile.java" />
、単に他のファイルのコーディングを取得することは望ましくありません。
于 2013-06-21T07:59:30.197 に答える
1
src/main/resources- は、Java クラスで使用されるプロパティ ファイルまたは xml ファイルのディレクトリです。css の場合、src/main/webapp/resources などの webapp ディレクトリにファイルを配置する必要があります。クライアントは、webapp ディレクトリの外にアクセスできません。
于 2013-06-21T08:17:49.887 に答える