问题
I want to display a BigInteger like this: "11111 22222 33333".
I tried the following, which does not work:
<f:convertNumber pattern="#00000 00000 00000" />
What am I doing wrong? :-/
Thanks in advance!
回答1:
The <f:convertNumber>
uses for BigInteger
the DecimalFormat API under the covers. As you can see in its javadoc, the blank space is not recognized as a pattern character. Valid pattern characters are 0
, #
, .
, -
, etc.
You seem to want to ouptut a non-standard format. You'd need to create a custom converter for the job.
See also:
- I need to convert h:outputtext
- DecimalFormat is being overridden by server settings
来源:https://stackoverflow.com/questions/17471141/jsf-convertnumber-pattern-with-whitespaces