I'm developing a little app with JSP and I need to convert the European app to an international one (compatible with US format..etc). I've founded the pattern option for tag formatNumber
here but it always depends on locale of your application.
Example 1:
I have a locale en_US and the formatNumber is:
<fmt:formatNumber pattern="#,##0.00" value="${number}"/>
Result: 15,463,536,640.00
Example 2:
I have a locale es_ES and the formatNumber is:
<fmt:formatNumber pattern="#,##0.00" value="${number}"/>
Result: 15.463.536.640,00
The thing it's that pattern it's related to locale! I need to use commas and dots independently from application locale because not always want to use locale format for show the numbers.
Any help?
Just explicitly set the locale.
<!-- Page's own locale (you should already have that part). -->
<fmt:setLocale value="${user.locale}" />
<fmt:setBundle ... />
... text ...
<!-- Temporarily set to English, format number and then set back to page locale. -->
<fmt:setLocale value="en_US" />
<fmt:formatNumber ... />
<fmt:setLocale value="${user.locale}" />
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