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

Star-based rating input

The rating component provides star-based rating with the ability to select and cancel.

How to do it…

The basic declaration for the component would be as follows:

<p:rating value="#{ratingBean.rate}" />

Here, the rate value binding is a java.lang.Integer definition. The default visual of the component will be as shown in the following screenshot:

How to do it…

The stars attribute sets the number of stars to display with a default value 5.

There's more…

With the readonly attribute, it's possible to only display the value output of the component by disabling user interaction. When set to true, the cancellation button will also not be rendered on ...

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