I have deployed a webapp at localhost:8080/Project
with Project being the context name. The webapp correctly redirects the user to the index.jsp.
But the css file in this index.jsp is not found (Error 404).
Index.jsp contains this reference:
<html lang="en">
<head>
<link href="../css/style.css" rel="stylesheet">
</head>
</html>
My project has the following structure in the WEB-INF folder:
WEB-INF/views/index.jsp
WEB-INF/css/style.css
I also tried to directly call the css file via url localhost:8080/Project/css/style.css
but this didn't work as well.
I relocated the css folder one level up (on the same level as WEB-INF) as suggested. The problem still persists. Do I have to exclude the urls starting with /css
in this @Controller
? Or maybe I'm on a wrong path...
@Controller
@RequestMapping("/")
public class IndexController {
@RequestMapping(method = RequestMethod.GET)
public String sayHello(ModelMap model) {
return "index";
}
}