spring mvc - How can I make input fields accept locale dependent number formatting? -


I am working on a Spring MVC project and especially part of the problem with Internationalization in form of number formatting Gaya. / P>

& lt; Fmt: formatNumber value = "$ {object [field]}" / / p>

I currently use fmt: formatNumber to format the number according to the currently selected locale. & Gt;

In this way, number formatting works well while displaying numbers. But how about the forms?

At the moment, the input fields that are going to get the float values ​​are prefilled with 0.0 and I hope "." As a decimal separator, no location is selected. Values ​​containing "," have been rejected by the server (... the string can not be converted to essential type float ...).

How can I use my input field and accept the appropriate number format too?

Have you seen? If you annotate the property then the input is bound to the field, then its proper formatting should be something like this:

  @NumberFormat (style = style.NUMBER) Private budicem;   

This is the style. I think, the thread is determined from the current locale.

Your app should be, see sections in Docs too.

Have suggested you can see it.

Comments