I have a Spring MVC webapp that used messages_xx.properties files. Currently I use
<fmt:message key="all.header.menu.items.start"/>
in my files. I just saw another tutorial reccomending
<spring:message code="all.header.menu.items.start"/>
Can anyone tell the difference? What are PROs and CONs?
Thanks!
rom the tag's doc here
It closely resembles JSTL's fmt:message-tag, however, the MessageSource classes can be integrated with the Spring context. Also, the spring:message- tag, works with the locale support that comes with Spring. Regards an HTML escaping setting, either on this tag instance, the page level, or the web.xml level. Can also apply JavaScript escaping.
If "code" isn't set or cannot be resolved, "text" will be used as default message. Thus, this tag can also be used for HTML escaping of any texts.
Here is another usage that is not supported by standard jstl
And here is 1 gotcha of using spring:message
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With