springboot thymeleaf 太美丽夫 模板 css js 路径问题
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" th:[email protected]{/bootstrap/css/bootstrap.min.css}/>
<head th:insert="~{common/common :: copy('aaa')}">
引入 common 页面
<head th:fragment="copy(title)">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" th:[email protected]{bootstrap/css/bootstrap.min.css} />
<link rel="stylesheet" href="css/index_demo3.css" th:[email protected]{css/index_demo3.css} />
....................................
无法找到页面。 不写斜杠 thymeleaf (不知道如何拼 就叫它 太美丽吧) 认为是相对路径, 所以造成 无法加载js.
只有 在 controller requestMapper("sys/aaa/bbb"); 请求 加载太美丽 页面 中引入的js路径添加一段 sys/aaa/xxxx/aaa.js
但是controller requestMapper("/bbb"); 写成这样就不会出这问题。 这就是 相对路径和绝对路径造成的原因。