JSF convertNumber Pattern with whitespaces

拟墨画扇 提交于 2019-12-24 08:15:55

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!