hymeleaf的三种变量使用方法

最主要就是加上thymeleaf与js结合的语句,常见的thymeleaf内联语句有三种

<script th:inline="javascript"></script>
用于js的
<span th:text="${session.user.name}">Sebastian</span>
用于普通html,任意位置都可以。默认也可以省略不写,thymeleaf也是支持的。
<body th:inline="text">
  <p>Hello, [[${session.user.name}]]!</p>
</body>
直接用于父标签,子标签可以直接使用

 

posted @ 2021-11-02 16:10  浅笑19  阅读(67)  评论(0)    收藏  举报