Force users to enter only digits in JSF

Hi,

if you want to force user to enter only digits while entering a numeric data like age, amount etc. you can use PrimeFaces’ inputMask component as follows:

<p:inputMask id="age" label="Age" value="#{bean.age} placeHolder=" " mask="?99"/>

This component with ?99 mask forces users to enter ages from 0 to 99

Easy, huh?

You can see other possible masked inputs from here : http://primefaces.org:8080/prime-showcase/ui/inputMask.jsf