需要從後臺模型變量中存儲的 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的內容也能原樣輸出
這樣,終於能解決 後臺埋碼的問題了
本文內容到此結束。