O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

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

Time for action – using the Slider component

Let us see how to use Slider as a range selector.

Create a Slider component with the range attribute set to true:

<h:panelGrid columns="1" style="margin-bottom:10px"> 
  <h:outputText id="displayRange" value="Between #{sliderController.minPrice} and #{sliderController.maxPrice}"/> 
  <p:slider for="minPriceId1,maxPriceId2" display="displayRange" style="width:300px" range="true" displayTemplate="Between {min} and {max}"/>
  <h:inputHidden id="minPriceId1" value="#{sliderController.minPrice}" />
  <h:inputHidden id="maxPriceId2" value="#{sliderController.maxPrice}" />
</h:panelGrid>

What just happened?

We have used the <p:slider> component along with the range="true" attribute, which makes it as range selector. We ...

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