commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Young <>
Subject Re: fmt:formatNumber to format currency does not display negative amounts
Date Tue, 19 Aug 2003 18:59:50 GMT

         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 

View raw message