【发布时间】:2014-06-06 14:21:43
【问题描述】:
使用 thymeleaf 有没有办法用我的页面特定的 javascript 和 javascript 来装饰我的布局?
<!--My Layout -->
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div th:replace="fragments/header :: header">
</div>
<div class="container">
<div layout:fragment="content">
</div>
</div>
</body>
</html>
<!--My Page -->
<!DOCTYPE html>
<html layout:decorator="layout">
<head>
</head>
<body>
<div layout:fragment="content">
hello world
</div>
<script src="pageSpecific1.js"></script>
<script src="pageSpecific2.js"></script>
<script>
alert("hello world")
</script>
</body>
</html>
【问题讨论】:
-
你到底想做什么?将javascript移动到布局中?还是我误解了这个问题?
-
您的 javascript 存储在哪里? thymeleaf 模板怎么样?
标签: spring-mvc thymeleaf