According to this post from 3 years ago the only way to display a spring message in a jstl tag is to wrap it in a <c:set var="someVar">
which does "work" but it seems very far from ideal.
Fast forward 3 years, is this still the only way to handle this?
Here is my code
Works, but not "ideal"
<c:set var="closeMessage">
<spring:message code='lman.ilr.closeItemDetail'/>
</c:set>
<dsg:sidePanelContent closePanelText="${closeMessage}">
Doesn't work, returns a string of <spring:message code='lman.ilr.closeItemDetail'/>
<dsg:sidePanelContent closePanelText="<spring:message code='lman.ilr.closeItemDetail'/>">
The spring message tag, just as fmt:message
, has a var attribute that can be used to store the message instead of displaying it.
It always helps to read the documentation.
Also, your wrong message probably comes from forgettin to declare the spring taglib at the top of your JSP.