I have a jsp in which I use spring s:message tag
<s:message code="application.success" arguments="${applicationRefId}" />
applicationRefId is a long variable added to the model.
In my resource bundle, I have defined message code quite regularly as
application.success=Application {0} successfully submitted
But this results in
Application 74,311 successfully submitted
Here my long value is formatted with commas. I have two questions - Why does this formatting happen, by default, and how can I prevent it?
As far as I know you can either
convert applicationRefId
to String before passing it to messageTag
or apply formatting in your resource bundle
application.success=Application {0, number, #} successfully submitted
Second solution documentation
From the MessageFormat
documentation
FormatElement: { ArgumentIndex } { ArgumentIndex , FormatType } { ArgumentIndex , FormatType , FormatStyle }
And this chart
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