2

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Nazar Sobchuk
  • 297
  • 1
  • 7
  • 17

2 Answers2

3

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" />

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.

MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125
  • Now THAT makes sense. Thanks a lot :) I was fighting this problem for a few hours because my mentor told me that it's my "smart NetBeans" problem and he wanted the webapp to be structured exactly this way: css file under resources. Hope, he will change his mind after I have sent him your answer. Thank you a lot. :) – Nazar Sobchuk Jun 21 '13 at 08:14
1

src/main/resources- is the directory of properties file or xml file that used by Java classes. For css you should place your file in webapp directory like src/main/webapp/resources. Client can't get any access outside of webapp directory.

Masudul
  • 21,823
  • 5
  • 43
  • 58