📜  Primefaces评分

📅  最后修改于: 2021-01-08 04:21:17             🧑  作者: Mango

PrimeFaces评分

这是一个基于星级的评分系统。它用于将用户输入作为评分。当我们想获得用户反馈时,它很有用。它主要用于获得产品评级。

评分属性

Attribute Default value Type Description
required false Boolean It makes the component as required.
Validator null MethodExpr It is a method binding expression that refers to a method validating the input.
valueChangeListener null MethodExpr A method binding expression that refers to a method for handling a value change event.
requiredMessage null String It is used to set message to be displayed when required field
validation fails.
converterMessage null String It is used to set message to be displayed when conversion fails.
validatorMessage null String It is used to set Message to be displayed when validation fields.
widgetVar null String It is a name of the client side widget.
stars 5 Integer It is used to display number of stars.
disabled false Boolean It disables user interaction.
readonly false Boolean It disables user interaction without disabled visuals.
onRate null String Client side callback to execute when rate happens.
style null String It is used to set inline CSS of the component.
cancel true Boolean It is used to cancel.

在下面的示例中,我们正在实现组件。本示例包含以下文件。

JSF文件

// rating.xhtml





Rating










ManagedBean

// Keyboard.java

package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class Rating {
private Integer rating;
public Integer getRating() {
return rating;
}
public void setRating(Integer rating) {
this.rating = rating;
}
}

输出: