2

I am using for the first time Java Web in Netbeans IDE 8.0.2, I've added the css sheets in an assets folder at the same level as WEB-INF under Web Pages directory, and I included them as follow:

<link href="./assets/css/style.css" rel="stylesheet">

I also tried: <link href="assets/css/style.css" rel="stylesheet">

But for some reason, my pages are displayed as if there's no css sheets How should I include them in another way? Or is there something I need to add?

Thank you

3
  • 1
    what happens if you full the path above on the browser? are you able to get to the CSS file? Commented May 18, 2016 at 19:09
  • No! I am getting HTTP status 404 Not Found. Commented May 18, 2016 at 19:12
  • 1
    then the file is not copied to the 'deployment' folder... I do not use NetBeans IDE but how are you deploying your app? (in WAR format? or exploded mode?) - if WAR, ensure your CSS path is added to the build path; Commented May 18, 2016 at 19:14

1 Answer 1

1

I don't know anything about Netbeans, but have you tried using the style tag or the style attribute? If the style tag works you probably have a typo in your file directory.

<style>p{color:red;}</style>
<p style="color: red;"></p>
Sign up to request clarification or add additional context in comments.

3 Comments

I tried what you said and it's working, so I think my problem is in the path it cannot be a typo, but I cant seem to fix it. Thank you
after looking at your post again your link is wrong it should be ../assets/css/style.css it needs two periods
I really didn't know what the problem was, i just clean and build the project and it worked! Weiirrd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.