0

I have this piece of code:

<p:inputText  value="#{addnewfields.price}">          
    <f:convertNumber  type="number" />
</p:inputText>

So what I want to do is to display my number with space separators.

But still in my input it looks like 1000000 instead of 1 000 000.

Any ideas?

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
user2950593
  • 9,233
  • 15
  • 67
  • 131
  • Look here : http://stackoverflow.com/a/5323547/2459449 – Omar Dec 14 '14 at 09:56
  • Try applying this attribute to `` - `pattern="### ###"` (There is a space in between). Note : I am trying to shoot in the dark. I did not try it myself. – Tiny Dec 14 '14 at 12:19

1 Answers1

1

A possible solution you can try is to create your own converter. The InputText value is a String, you have to manage the conversion from this String to the object number you want.

The converter has two functions to implement: from the object (binded value) to String (text shown in the input) and from the String to the object.

You can see a converter example here: http://www.mkyong.com/jsf2/custom-converter-in-jsf-2-0/

Corus
  • 101
  • 3