【发布时间】:2015-05-13 10:11:12
【问题描述】:
我的 Spring Boot 应用程序中有一个 messages.property 文件。比如:
welcome=Hello {0} welcome to my page
现在我可以通过 thymeleaf 访问它了:
<th th:text="#{welcome(${Firstname})}"></th>
但我想做的是显示:你好 John Doe,欢迎来到我的页面。 John 和 Doe 是不同的变量,我会在欢迎信息中注入。
也许我的属性文件现在看起来像:message= Hello {0} {1}, Welcome to my page
有没有办法在 spring/thymeleaf 中实现这一点?
【问题讨论】:
-
你不能不使用会话或cookies吗?
-
我不想从属性文件中获取消息值,它是静态的,只能从messages.properties文件中编辑
标签: php spring spring-boot thymeleaf