You need to format the number how you would like it.
If you have a fixed format and don't have to worry about
internationalization then you could just add another method to your class
that returns it formatted the way you like i.e. getCurrentMoneyFormatted().

However if you need to internationalize your app and you want it formatted
correctly based on the Locale of the user then you can use a resource file
with formatting info.

MyResource:
my.money={0,number,currency}

<s:text name="my.money">
   <s:param value="#session.cart.currentMoney" />
</s:text>

See http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html for
info on the {0,number,currency} message format.

To make this stuff easier I would implement a formatCurrency() method in
your base action class so you could write like this:

    <s:property value="formatCurrency(#session.cart.currentMoney)"/>


On Thu, Jun 4, 2009 at 11:39 AM, Stefano Tranquillini <
stefano.tranquill...@gmail.com> wrote:

> Hi all.
> i've a little problem.
> I've a EJB inside my session, i take it from a jsp and print out some
> values:
> <s:property value="#session.cart.currentMoney"/>
>
> now, this value is a double. and struts print 2.0E09
> how can i print 200000000.0. so the entire number without exponent?
> thanks
>
>
> --
> Stefano
>

Reply via email to