【发布时间】:2017-04-25 20:03:25
【问题描述】:
我目前正在开发 Spring Boot 和 thymeleaf 的 Web 应用程序。 我设法通过从文件夹“resources/static”中调用资源 css 和 js 来设置 web-front。
但是,对于“resources/template/app/index.html”文件夹中的用户空间,我不能在“resources/static/app_css/bootstrap.css”中调用我的css。
这是我的文件树:
我的 index.html 来自 resources/templates/app/
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:include="app_fragments/header :: header">
<p>Header</p>
</head>
<body>
<!-- Indicates a successful or positive action -->
<button type="button" class="btn btn-success">Success</button>
</body>
</html>
resources/templates/app_fragments/ 我的头文件片段:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="header">
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<link rel="shortcut icon" th:href="@{../resources/app_fonts/app_images/favicon.png}" href="../resources/static/app_fonts/app_images/favicon.png" type="image/png"/>
<title>Toto</title>
<!-- Plugins CSS -->
<link rel="stylesheet" type="text/css" media="all" th:href="@{../resources/static/app_css/bootstrap.min.css}" href="../resources/static/app_css/bootstrap.min.css" />
</head>
</html>
当我进入用户空间时,我无法从http://localhost:8081/app/index.html 加载我的引导文件
如何解决?
提前致谢。
【问题讨论】:
标签: twitter-bootstrap spring-mvc spring-boot thymeleaf