根据这个post from 3 years ago,在jSTL标记中显示spring消息的唯一方法是将其包装在<c:set var="someVar">
中,该代码可以“起作用”,但看起来与理想情况相去甚远。
快进3年了,这仍然是解决此问题的唯一方法吗?
这是我的代码
可行,但不是“理想”
<c:set var="closeMessage">
<spring:message code='lman.ilr.closeItemDetail'/>
</c:set>
<dsg:sidePanelContent closePanelText="${closeMessage}">
不起作用,返回字符串
<spring:message code='lman.ilr.closeItemDetail'/>
<dsg:sidePanelContent closePanelText="<spring:message code='lman.ilr.closeItemDetail'/>">
最佳答案
spring消息标签与fmt:message
一样,具有var属性,可用于存储消息而不是显示消息。
阅读the documentation总是有帮助的。
另外,您的错误信息可能来自忘了在JSP的顶部声明spring taglib的消息。
关于JSTL标签中的Spring消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17949382/