0

I have created a jsp file called top.jsp and a css file called top.css. My problem is that my top.jsp doesn't show the background color specified in top.css.

Code in top.css

@CHARSET "ISO-8859-1";

body { 
    background-color: blue; 
    }

Code in top.jsp

<link rel="stylesheet" type="text/css" href="css/top.css"/>

What do I need to do in order to make the background color blue?

Here is a picture of my file structure:

enter image description here

0

1 Answer 1

2

Your <link rel="stylesheet" type="text/css" href="css/top.css"/> statement is looking for a css folder inside the same folder as the top.jsp file. This means it's looking for your css in the wrong place: currently it's looking for -> /jsp/css/top.css

You actually want it to go up one level in the folder structure to be in the webapp folder and then into the css folder so you need to change your href to href="../css/top.css" (the .. takes you up to the webapp folder and out of the jsp folder).

Sign up to request clarification or add additional context in comments.

Comments

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.