struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gemes Tibor <...@i-trade.hu>
Subject Re: [validator] numbers with localized decimal separator
Date Wed, 15 Jan 2003 20:57:16 GMT
2003-01-15, sze keltezéssel Rod McChesney ezt írta:
> This is deeper in the validation code, but I believe that
> java.text.DecimalFormat should be used for float
> or double parsing. Using Double d = new Double(string)
> the way GenericTypeValidator does will not work right in other locales.
> 
> The javadoc for class Double says this in the secion on the
> valueOf(String s) method:
> 
>    To interpret localized string representations of a
>    floating-point value, use subclasses of NumberFormat.

I use NumberFormat extensively in converting the String into float. That
is fine. Imho the problem is that the validation javascript is static. I
don't know how to obtain the current Locale in the script.

Maybe I should not try to find it out via javascript but modify the
validator framework to generate a string representation as a parameter
to the validation function call. The validation script function would
know somehow the exception locales to the '.' separators. If there is no
other way then even in a constant map.

Any ideas?

Tib


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message