This content has been marked as final.
Show 2 replies
-
1. Re: global convertNumber
chris.simons May 12, 2010 10:16 PM (in response to jmchiaradia)Of course, there are several ways that you could do this.
First thing that comes to mind is to stick that pattern into a properties file and reference it via EL, such as #{messages['pattern.number']}, assuming that was the name of the property key.
Or, you could make a managed bean to store these kinds of application-level/runtime values, such as a class called ConverterHelper that you declare in faces-config.
-
2. Re: global convertNumber
raphaufrj May 13, 2010 12:44 AM (in response to jmchiaradia)There is another way for it if you're using faceletes. You can create one component easily.
1. Declare a taglib in xml file
`
<facelet-taglib>
<namespace>http://teste.com.br/jsf</namespace>
<tag>
<tag-name>numeric</tag-name>
<source>../layout/numeric.xhtml</source>
</tag>
</facelet-taglib>
`
2. In numeric.xhtml
`
<h:inputText id="#{id}" value="#{value}" disabled="#{disabled}" style="#{styleComponent}">
<f:convertNumber pattern="##.00"></f:convertNumber>
</h:inputText>
`
3. In your real xhtml
`
<teste:numeric id="test" />
`
Do not forget to declare xmlns:teste="http://teste.com.br/jsf" in the top of page...