JSF Spinner

0.9.0 version of PrimeFaces introduces a new spinner component. Spinner uses increment and decrement buttons to provide a numerical input.

spinner

Integers

In it’s simplest form spinner steps by 1 so it’s suitable for integer values.

<p:spinner value="#{bean.number}" />

Decimals

Floating numbers are also supported using the stepFactor attribute. Following spinner will increment or decrement by 0.25.

<p:spinner value="#{bean.number}" stepFactor="0.25"/>

Online Demo

See the online demo for the examples I’ve given here in action.

2 Responses to “JSF Spinner”

  1. matthiaswessendorf Says:

    does adding a validator / converter work ?

    Like displaying the actual number as percentage ?

  2. cagataycivici Says:

    Never tried but it should :)


Comments are closed.