1、day09.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>day09</title>
</head>
<body>
day09
<th:block th:replace="jss/abc"></th:block>
<th:block th:replace="jss/day09_js"></th:block>
</body>
</html>
2、day09_js
<script type="text/javascript">
$(document).ready(function () {
alert(".......day09")
})
</script>
3、abc
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
本文介绍了一个使用Thymeleaf进行模板替换的例子,展示了如何在HTML中使用Thymeleaf的th:replace属性来包含外部JavaScript文件。通过这个例子,读者可以了解Thymeleaf的基本用法,包括如何引入jQuery库并执行简单的JavaScript代码。
330

被折叠的 条评论
为什么被折叠?



