Java – use variables / expressions in comments (in the thymeleaf template)

I need to add some information about the generation to the page

</html>
<!-- page [[${pageCode}]] was generated at [[${#dates.format(currentDate,‘dd/MMM/yyyy HH:mm’)}]]  -->

But it doesn't work for me What should I configure or do otherwise?

Solution

You are looking for the first example below

Template marker 1

<span th:inline="text" th:remove="tag" >
   <!-- page [[${pageCode}]] was generated at [[${#dates.format(currentDate,‘dd/MMM/yyyy HH:mm’)}]]  -->
</span>

Result 1 <- Page [[${pagecode}]] is generated on [[${#dates. Format (CurrentDate, 'DD / MMM / yyyy HH: mm')}]] - >

Template Mark 2

<span th:text="inline" th:remove="tag" >
   <!-- page [[${pageCode}]] was generated at [[${#dates.format(currentDate,‘dd/MMM/yyyy HH:mm’)}]]  -->
</span>

Outcome 2 inline

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>