You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Larry Young <ly...@dalmatian.com> on 2003/08/19 20:59:50 UTC
Re: fmt:formatNumber to format currency does not display
negative amounts
Radhika,
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 ---
Larry
At 09:39 PM 8/19/03 +0530, you wrote:
>Hi,
>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"
>value="${requestScope['selectedLease'].elcoCost.decimalAmount}"
>currencySymbol=""/>
>Appreciate any help/suggestions on this.
>
>Thanks
>Radhika
>
>
>
>____________________________________________________________
>Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
>http://login.mail.lycos.com/r/referral?aid=27005
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
--------------------------
Larry Young
The Dalmatian Group
www.dalmatian.com