我正在尝试将一些文本 append 到动态文本中,如下所示:
<label th:text="Hello ${worldText}"></label>
但用户界面抛出:
TemplateProcessingException: Could not parse as expression: "Hello ${worldText}
有谁知道我怎样才能做到这一点?
最佳答案
一个简单的解决方案是在标签中插入一个跨度:
<label>Hello <span th:text="${worldText}"></span></label>
但我更愿意像这样组合文本和变量:
<label th:text="'Hello' + ${worldText}"></label>
关于spring-mvc - Thymeleaf: <label> 将动态文本与静态文本 Spring MVC 连接起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46118988/