且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在JSF中格式化双精度

更新时间:2023-11-10 09:32:28

如果我不误解您的要求,则可以在呈现视图的过程中使用以下方法实现输入框中的值格式:

If I'm not misunderstanding your requirement, I was able to achieve formatting of the value in the input box during the rendering of the view with:

<h:inputText id="text1" value="#{...}">
    <f:convertNumber pattern="#,###,##0.00"/>
</h:inputText>

我在供应商品牌的Eclipse中使用了Standard Faces组件,因此我假设pattern属性是标准JSF的一部分.

I was using the Standard Faces Components in my vendor-branded Eclipse so I'm assuming the pattern attribute is part of standard JSF.