You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2009/04/16 22:32:51 UTC

interceptor for dollar amount

Does struts2 have any interceptor that would automatically convert an
integer to a String and show it as a dollar amount.

so 7 would be $7.00

5.56 would be $5.56

Re: interceptor for dollar amount

Posted by Chris Pratt <th...@gmail.com>.
That's really not a job for an Interceptor.  But the <s:text> tag might do
what you want.  Set up a property in your application properties something
like:

currency.format={0,number,currency}

Then in your page you can use:

<s:text name="currency.format"><s:param value="%{amount}"/></s:text>

Works for dates or building up text containing replacement parameters as
well.
  (*Chris*)

On Thu, Apr 16, 2009 at 1:32 PM, Bhaarat Sharma <bh...@gmail.com> wrote:

> Does struts2 have any interceptor that would automatically convert an
> integer to a String and show it as a dollar amount.
>
> so 7 would be $7.00
>
> 5.56 would be $5.56
>