在我的页面上登录后,spring 使用以下 Controller 将我重定向到我的主站点:
//Login Success
@GetMapping("/login-success")
public ModelAndView loginSuccess() {
return new ModelAndView("/cont/home.html");
}
URL 看起来像:
http://localhost:8080/login-success
它是home.html 的HTML 结构,但未加载CSS。 如果我导航到 http://localhost:8080/cont/home.html它是有样式的。
感谢您的帮助。 :)
最佳答案
像下面这样尝试
return new ModelAndView("/CONTEXT_PATH/cont/home.html");
或
response.sendRedirect("/cont/home.html");
return;
指定上下文路径以便加载页面
关于java - CSS 未加载 || Spring ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52817241/