Controller中有这样的重定向:
return "redirect:login?message=login.registered";
在 html 模板中,我想显示 login.registered
键的属性值。
在 jsp 中它只是:
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
...
<spring:message code="${param.message}"/>
如何使用 Thymeleaf 执行相同操作?
最佳答案
我认为在 thymeleaf 中,您可以使用 #messages 对象来做到这一点。这应该有效:
<div th:text="${#messages.msg(param.message)}" />
关于java - 我 thymeleaf 如何使用页面参数作为属性键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43939232/