Spinner – different ways to provide input
The input component spinner
provides a numerical input via increment and decrement buttons.
How to do it…
A basic definition of the component would be as follows:
<p:spinner value="#{spinnerBean.intValue}" />
This will render an input textbox on the page, with controls to increase and decrease the value as shown in the following screenshot:
There's more…
The stepFactor
attribute defines the stepping factor that will be applied for each increment and decrement with the default value 1
. The following definition will increase or decrease the value by 0.5
:
<p:spinner value="#{spinnerBean.doubleValue}" stepFactor="0.5" ...
Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.