jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <martin.coo...@tumbleweed.com>
Subject Bugs in <fmt:formatNumber> and <fmt:parseNumber>?
Date Sat, 27 Apr 2002 05:40:47 GMT
The first bug relates to parsing failures. If I set my machine to believe
it's French and use the following tag:

<fmt:formatNumber value="1001.02" />

the result is "1 001,02", as expected. Now, if I try to parse the same
string (with my machine still believing it's French) using this:

<fmt:parseNumber value="1 001,02" />

the result is "1". Obviously, it didn't work correctly. Even if I use this:

<fmt:parseNumber value="1 001,02" parseLocale="fr_FR" />

I get the same result (i.e. "1").

This is with the 4/26 nightly build running on JDK 1.4.0.

The second bug is more a bug of omission, I believe, although it seems quite
serious to me. On the other hand, it's quite possible that I'm simply
missing the obvious.

While I can use the 'parseLocale' attribute of the <fmt:parseNumber> to
parse a number from any locale (assuming I know the correct locale), there
appears to be no way to format a number for any locale (short of switching
my machine's locale). I would have expected a 'locale' attribute on the
<fmt:formatNumber> tag to allow me to do this.

Just as an example, I'd like to be able to output the following using JSTL:

-----
Numbers are formatted differently in different parts of the world. For
example, the number 1001.02 is formatted as "1,001.02" in England, but as "1
001,02" in France.
-----

I don't see a way of doing this (dynamically, I mean) without a 'locale'
attribute on the <fmt:formatNumber> tag.

Thanks!

--
Martin Cooper



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


Mime
View raw message