myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: currencyConverter -> BigDecimal storage
Date Fri, 05 May 2006 18:40:33 GMT
On 5/5/06, Julian Ray <julianjray@yahoo.com> wrote:
> How about creating a CurrencyConverter which would have configurable and
> localizable currency formats as well as style for positive and negative
> values etc. Is there any value in this?
>
> If we could drum up a list of requirements I would be willing to get it
> started as I have to build one anyway in the very near future.

Hey Julian,

I think f:convertNumber can do all of this already.

http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/f/convertNumber.html

The only problem with it is that it returns a Number (internally
either a Long or Double - depending on the input), which means your
backing beans must represent currency via Number getters and setters.

I'm thinking that subclassing NumberConverter and coercing the type is
probably all that's necessary.   But since I'm using Facelets, I don't
have a lot of interest in creating jsp tags and tlds and all that JSP
support unless there's actual interest beyond my own personal use.

Mario's idea of supporting configurable return types sounds good if
this is going to become a public component.

Mime
View raw message