Explain the [[...]] inline in Thymeleaf in detail

  thymeleaf of [[.....]] inline simplifies the problem thymeleaf the value, for example as follows:

<-- 从session中取值 -->
<div>[[${session.username}]]</div>

  Equivalent to:

<div th:text="${session.username}"></div>

To put it bluntly, it is the text value.

But in JavaScript, you need to add th:inline="javascript">

<script th:inline="javascript">
    var user = [[${session.username}]];
</script>

 

 

Guess you like

Origin blog.csdn.net/Sunshineoe/article/details/114594648