需要从后台模型变量中存储的 js 脚本输出到页面上,常见的语法都解决不了,后来在官网提供的Using Thymeleaf 的pdf教程看到:
13 Textual template modes
Three of the Thymeleaf template modes are considered textual: TEXT , JAVASCRIPT and CSS . This differentiates them
from the markup template modes: HTML and XML .
a perfectly valid template for a text email.
Dear [(${name})],
Please find attached the results of the report you requested
with name "[(${report.name})]".
Sincerely,
The Reporter.
终于找到了 [(${name})] 这个语法,可以不转义直接输出模型中的值,js的内容也能原样输出
这样,终于能解决 后台埋码的问题了
本文内容到此结束。