(1) Use BigDecimal for all financial currency amounts
(2) Write your own Custom Tag to print out monetary data.

It is easy to subclass org.apache.struts.taglib.bean.WriteTag
to provide a custom tag similar to

<acme:numberFormat  format="#,###.00(#,###.00)"  name="obj" property="moneyAttr" />

--
Peter Pilgrim                       ++44 (0)207-545-9923

............................................ Swamped under electronic mails


---------------------------------------- Message History 
----------------------------------------


From:  "Galbreath, Mark" <[EMAIL PROTECTED]> on 30/04/2002 18:15 AST

Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>

To:    "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
cc:
Subject:    RE: Bean Bug?


I'd be interested in how you can use ints for decimal numbers.  The "right"
way is to use BIG_DECIMAL, but I have to use the session bean method given
me for my bean data.  But this still does not address the issue of the
<bean:write> behavior.

Mark

-----Original Message-----
From: Micael Padraig Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:00 PM

First Principle of Economics: ever use float or double for money.  Use
ints.  Or, for serious money, longs.  'The real problem is not the "output"
but the whole idea.

micael

At 05:56 PM 4/30/02 -0400, you wrote:
>I'm using a simple <bean:write name="phone" property="price" /> which grabs
>a float price from the form bean.  The display, however, is unpredictable.
>For a price of 25.00, e.g., can get returns of "25.00," "25.0" and "25."
>Anybody else experiencing this behavior?  I've had to wrap the <bean:write>
>with JavaScript to get the formatting correct.
>
>Mark
>"De recta non tolerandum sunt."
>



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>






--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to