Reputation: 41
Cannot find the correct path for css that must be included to .jsp file.
The css files are in css folder and jsp is in folder "views" as shown in this picture. Have tried different paths to include it, but without result.
<link href="<c:url value="..." />" rel="stylesheet">
<link href="..." rel="stylesheet"/>
Could someone give information or correct path from .jsp file ?
Upvotes: 0
Views: 889
Reputation: 81
you can use ./css/yourfilename as the path
./ means one up the current directory but the best way to do it is using the absolute path there are many advantage of using the absolute paths for example href="http:www.example.com/css/main.css" .
as meantioned by simon the web-inf could also be the problem
Upvotes: 0
Reputation: 51
Since WEB-INF
folder is protected by server, you should move css
& js
folder to upper level, means css
& js
folder should exists in WebContent
folder directly.
The structure should be like this:
-WebContent
-META-INF
-WEB-INF
-css
-js
Upvotes: 1
Reputation: 470
The relationship between where files physically exist in project structure and where they are in runtime context is a classic problem (in my experience) with Java.
You could try using:
System.out.println(System.getProperty("user.dir"));
to find out the directory at runtime and use this to build a correct reference to your stylesheet.
Upvotes: 0