Justin Olomar wrote:Thank you very much! I've written a class that extends NumberConverter just as shown in the non-AspectJ example you linked to. How do I get my custom converter registered with all fields using the <f:convertNumber type="currency" /> converter? I've tried adding the following to my faces-config.xml, but unfortunately it still seems to use the built-in NumberConverter class.
Sorry for the newbie questions, but, well....I AM a newbie to JSF. :banghead:
If you are using a tag (f:convertNumber), it will still use the code backing that tag. The converters registered per class, as you have configured, should automatically be used when it cannot find another converter and you haven't specified one. Did you try removing the f:convertNumber tag, not specifying an f:converter, or a converter on your h:inputText, h:outputText, or whatever tag you're using, and seeing if it works? You will almost certainly run into an issue because you then have no way of specifying the type of conversion (you probably want "currency", since that's the topic). If you hard code it to use currency, it will affect every Number conversion, and that's probably not what you want.
Since you still want to use f:convertNumber, you have to reconfigure the f tag library somehow. You can patch it. You can also create your own tag library with your own convertNumber tag. Or, you can just amend what's already there with the AspectJ example.