I’ve found strange behavior with the format tag library. I’m formatting a copyright message in the footer of a webpage. I’m using the following pseudo code:
<fmt:message var="copyright" key="someKey">
<fmt:param value="${year}"/>
</fmt:message>
...
<c:out value="${copyright}"/>
I’m just passing the year as an argument into the resource bundle. If you c-out the year value before passing it in:
<c:out value="${year}"/>
<%-- renders as 2012 --%>
But after the argument gets passed in, the year gets formatted as a number. The number is rendered as 2,012.
I’ve googled and asked around and haven’t found anything besides the generic Oracle documentation (http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/tld-summary.html)
Has anyone else reached this?
Thanks in advance.
It’s been interpreted as a
NumberbyMessageFormatand hence being formatted with a thousands separator which can be a comma or a dot, depending on the current locale. You can prevent it being interpreted as aNumberby adding a zero width space: