I don't like the way f:convertNumber
display NaN ("\ufffd"
) and both of the infinities ("\u221e"
).
Is there a way to extend the out-of-the-box converter in order to inject my own display logic? Thank you.
I don't like the way f:convertNumber
display NaN ("\ufffd"
) and both of the infinities ("\u221e"
).
Is there a way to extend the out-of-the-box converter in order to inject my own display logic? Thank you.
To do this:
Override the getAsString method by explicitly handling your special values, and deferring to super
for all others. Pseudocode:
getAsString(FacesContext ctx, UIComponent component, Object value) {
if (value is NaN) {
return your-own-NaN-string;
}
if (value is infinity) {
return your-own-infinity-string;
}
return super.getAsNumber(ctx, component, value);
}
f:convertNumber
.