O'Reilly logo

PrimeFaces Cookbook - Second Edition by Oleg Varaksin, Mert Çalışkan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

How to do it…

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required