Spinner – different ways to provide input
spinner
is an input component that 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="#{spinnerController.intValue}" />
This will render an input text box on the page, with controls to increase and decrease the value.
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="#{spinnerController.doubleValue}" stepFactor="0.5" />
Adding prefix and suffix
The prefix
and suffix
attributes provide the ability to place fixed strings on the input field as prefix or suffix to the input respectively. The first definition will render the $
sign as a prefix and second one will render the %
sign with the value of the input field.
<p:spinner value="#{spinnerController.intValue...