2

enter image description here

the page popup.JSP contains:

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

as you see the folder css is there and it contains the bootstraps.css file, but i am getting error that :

http://localhost:8080/PhorestIntegrationPopup/css/bootstrap.css'

can't be found

Marco Dinatsoli
  • 10,322
  • 37
  • 139
  • 253

1 Answers1

3

In order for the css folder to be served to browsers, it needs to be outside of the WEB-INF folder. The servlet spec prohibits serving any content that is within this folder. (Even if it would allow it - WEB-INF is missing in the URL that you state, so there are two reasons for the file not being found)

The same goes for your JS files, which seem to be within the same folder. Move both up one directory, so that they're in the same folder as WEB-INF, but not within that folder.

JSPs can be in WEB-INF, because they just mimic code that is executed server side - however, if they are you can't reach them through any URL, only through a servlet's internal redirection. Decide for yourself if that's what you want - it secures you from unwanted information disclosure (should there be an issue within JSPs), but you'll have more work. It all depends on the framework that you're using on top of the Servlet/JSP API.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • well i put the css folder inside the web content, but i still get the same error message – Marco Dinatsoli Apr 24 '16 at 09:19
  • What's the actual URL that the browser tries to request from the server? Identify that and change the URL accordingly. It might be best to use something like `<%=request.getContextPath()%>/css/bootstrap.css` as your URL rather than using a relative URL. The whole issue is also [explained well here](https://stackoverflow.com/questions/2386031) – Olaf Kock Apr 24 '16 at 09:22