html - 执行 Thymeleaf :从变量插入
问题描述
我找不到从 Thymeleaf 中的模型字符串显示以下 html 内容的解决方案:
<div layout:insert="~{components/component :: component(parameter)}"></div>
我在 Kotlin 中通过以下方式设置了 html 字符串:
model["component"] =
"<div layout:insert=\"~{components/component :: component(parameter)}\"></div>".replace('\"', '"')
我希望将变量内容显示为字符串并执行它以显示组件外观,但我只能让字符串部分与 https://stackoverflow.com/a/64805372/1383108中的想法一起工作:
[[${component}]]
我已经尝试过[(${component})]
和组合__${}
来启用预处理,但一切都没有成功,所以我希望有一些新的想法。它在检查器中显示为 html,但未处理 Thymeleaf 部分。
解决方案
推荐阅读
- primeng - Primeng 多选需要带有“全选”文本的全选复选框
- firebase - 如何使用 ML Kit 云文本识别器进行颤振?
- ruby-on-rails - 如何验证文件以在 ruby 或 ruby on rails 中检查多个扩展名
- r - 使用 as.data.frame 形成数据帧时删除 0
- html - 有没有办法使这些列表元素大小相同?
- unit-testing - Tessy 中的序言/结语是什么?
- vue.js - 将参数传递给 v-dialog 而不是路由
- java - 查找特征文件中没有步骤方法定义的所有步骤?
- r - 在 R 的传单中为 fitBounds 添加填充
- python - 当数据框既是 int 又是字符串时,在 Dataframe 中查找行?