commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radhika Menon" <>
Subject Re: fmt:formatNumber to format currency does not displaynegative amounts
Date Tue, 19 Aug 2003 19:43:09 GMT
When I specified a pattern with fmt:formatNumber, it displayed the amount correctly with the
negative sign and decimal places.
If we specify a "pattern", it wont comply with internationalization.Is there any way that
we can internationalize the pattern similar to the messages resources?


--------- Original Message ---------

DATE: Tue, 19 Aug 2003 11:59:50
From: Larry Young <>
To: "Jakarta Commons Users List" <>

>         Sorry, I don't have direct experience with JSTL, so I can only 
>give you suggestions where to look.
>         The number (100) is an accounting equivalent for -100, both 
>specify a negative value.  The one you get is generally dependent on your 
>locale.  Based on the JSTL docs, and assuming that JSTL is simply utilizing 
>the Java DecimalFormat class, it would look like you need to specify the 
>"patttern" attribute for the "formatNumber" tag.  I'm not positive that it 
>takes the same value as the Java class "applyPattern" method does, but if 
>so, then you need to supply it with both a positive and negative pattern if 
>you want to enforce the minus sign on negative values.
>         I made my assumptions by looking at the JDK1.4 javadocs and also 
>the JSTL docs.  Good luck.
>--- regards ---
>At 09:39 PM 8/19/03 +0530, you wrote:
>>The jstl tag <fmt:formatNumber> to format currencies,
>>displays the absolute value for negative amounts.
>>For eg: if the amount is -100.00, it gets displayed as (100).
>>Is there anyway to prevent this behaviour?
>>I used the fmt tag as follows :
>><fmt:formatNumber type="currency" 
>>Appreciate any help/suggestions on this.
>>Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
>Larry Young
>The Dalmatian Group
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!

View raw message