It’s tedious and ugly to write things like:
<input type="button" value="<fmt:message key="submitKey" />" />
And in case you want to nest the message tag in another tag’s attribute it becomes even worse.
Is there any shorthand for that. For example (like in JSF):
<h:commandButton value="#{msg.shareKey}" />
(spring-mvc-only solutions applicable)
This feels like a bit of a hack, but you could write a custom implementation of
java.util.Mapwhich, whenget(key)is called, fetches the message from the SpringMessageSource. ThisMapcould be added to the model under themsgkey, allowing you to dereference the messages using${msg.myKey}.Perhaps there’s some other dynamic structure than is recognised by JSP EL that isn’t a
Map, but I can’t think of one offhand.As an alternative:
Then use
${var}as a regular EL.