有这样的一段代码来显示一个数字。
<af:inputText value="mybean.studentId" > <af:convertNumber type="number"> </af:inputText> <af:outputText value="mybean.studentId"> <af:convertNumber pattern="#{applCorePrefs.numberFormatPattern}"> </af:outputText>
adf application如何处理UI的number显示?
af:convertNumber官方文档:https://docs.oracle.com/cd/E23943_01/apirefs.1111/e12419/tagdoc/af_convertNumber.html
<af:convertNumber> type: oracle.adf.rich.Number This is an extension of the standard JSF javax.faces.convert.NumberConverter The converter provides all the standard functionality of the default NumberConverter and is strict while converting to object. JSF javax.faces.convert.NumberConverter will convert values like 22.22.2 or 22ABC to valid Number 22.22 and 22 respectively. Here it would result in a conversion failure and would throw a ConverterException. If number grouping separator, decimal separator is configured in adf-faces-config.xml file, it will be used during call to getAsObject() and getAsString() for parsing and formatting. If it has not been set, number grouping separator, decimal separator is defaulted based on the locale. If currencyCode is set on the converter then it will be used. Else uses the currencyCode set in adf-faces-config.xml file. If it is not set in the configuration file then it is defaulted based on the locale. Since ADF Faces is compatible with JDK 1.4 and higher versions, the currencyCode gets preference over currencySymbol. See JSF's javax.faces.convert.NumberConverter for the way in which currencyCode and currencySymbol gets preference for different version of JDK. This converter is automatically registered under the standard converter ID, and therefore will be used when the <f:convertNumber> tag is used. This converter also runs on the client (implements org.apache.myfaces.trinidad.convert.ClientConverter). One exception: If the pattern attribute is specified, the converter will run on the server. For more information see javadoc for org.apache.myfaces.trinidad.convert.NumberConverter
最后一段比较重要,说这个convert默认运行在client端,但如果pattern属性设置了,那就在server端运行。
它的属性有:
Oracle Fusion Applications针对localization formatting提供了一些标准和执导standards and guidelines。可以参考:
http://docs.oracle.com/cd/E36909_01/fusionapps.1111/e15524/ui_localize.htm#CACFBBIE
通过学习了这些标准后,其实在设置ID之类的数字时,需要使用
<af:convertNumber pattern="#{applCorePrefs.numericCodeFormatPattern}"/>
官网示例:
Example 20-13 Formatting ID Numbers <af:column headerText="#{bindings.Deliveries.hints.SalesOrderLine.label} id="c9" > <af:outputText value="#{row.bindings.SalesOrderLine.inputValue}" label="#{bindings.Deliveries.hints.SalesOrderLine.label}" id="outputText3"> <af:convertNumber pattern="#{applCorePrefs.numericCodeFormatPattern}"/> </af:outputText> </af:column>