I can see my bootstrap template using thymeleaf with spring boot.
When I request http://localhost:8080/student bootstrap resources work good, but when I request including some path variable like http://localhost:8080/student/3 bootstrap can't be uploaded. I'm getting this error from the browser Request Method:GET
Status Code:400. It tries to request bootstrap file like that http://localhost:8080/student/bootstrap.css.
I don't think I have any problems with declaring bootstrap files' path because other pages work fine. And my paths are from guide as resources/static/bootstrap.css I'm not using WebMvcConfig and I'm using default spring security.
@RequestMapping( value = "/student/{id}", method = RequestMethod.GET)
public String izinEkle(Model model, @PathVariable int id) {
studentService.getStudentlById(id);
Izin izin = new Izin();
model.addAttribute("izin",izin);
return "izinGiris";
}
--
<head lang="en">
<title>HolyDayTracker</title>
<link href="../static/bootstrap.css" th:href="@{bootstrap.css}" rel="stylesheet" media="screen">
<link href="../static/style.css" th:href="@{style.css}" rel="stylesheet">
<script src="http://cdn.jsdelivr.net/webjars/jquery/2.1.4/jquery.min.js th:src="@{../webjars/jquery/2.1.4/jquery.min.js}"></script>
bootstrap.csswill be a relative URL, and/studentand/student/3are on different levels, so they will relatively point to a different location forbootstrap.css. There are many solutions for this, most of them can be found in the linked question. The most common solutions are to use an absolute URL (as shown by @shi) or by setting a<base>tag in you<head>section so the base URL is the same for all paths.