struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Barefoot" <Joe.Baref...@motiva.com>
Subject RE: [validator] numbers with localized decimal separator
Date Wed, 15 Jan 2003 21:59:37 GMT
<snipped>

> > when it generates the JS, could just stick in the decimal separator 
> > character for the locale in the last request as a variable, rather 
> > than creating a variable for the locale itself.  No reason to store
> > all the locales and match in JS when you know the locale 
> based on the
> > previous request (in the validator code).  
> 
> I don't understand the above. I just simply cannot imagine how could I
> give the decimal separator to the javascript.

We are talking about modifying the Validator code itself right?  So just stick in:

Locale locale = (Locale) pageContext.getSession().getAttribute(Action.LOCALE_KEY);
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
String JSdecimalSeparator = "var decimalSeparator=" + symbols.getDecimalSeparator() + ";";

....and write this string into the JS being generated (wherever it belongs).  Refer to this
var in the JS functions wherever you need to match a decimal number's format.


peace,
Joe


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

--
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