📅  最后修改于: 2021-01-08 04:16:37             🧑  作者: Mango
它是一个输入文本,其中提供了递增和递减按钮。它用于获取输入文本中的用户输入。我们可以通过在JSF应用程序中使用 组件来创建它。
Attribute | Default value | Type | Description |
---|---|---|---|
id | null | String | It is an unique identifier of the component. |
rendered | true | Boolean | It is used to specify the rendering of the component. |
value | null | Object | It is used to set value of the component. |
required | false | Boolean | It is used to mark component as required. |
widgetVar | null | MethodExpr | It is used to set name of the client side widget. |
stepFactor | 1 | Double | It is a stepping factor for each increment and decrement. |
min | null | Double | It sets minimum boundary value. |
max | null | Double | It sets maximum boundary value. |
prefix | null | String | It is used to set prefix of the input. |
suffix | null | String | It is used to set suffix of the input. |
accesskey | null | String | It is an access key that when pressed transfers focus to the input element. |
maxlength | null | Integer | It is used to set maximum number of characters that may be entered in this field. |
onselect | null | String | It executes script when text within input element is selected by user. |
placeholder | null | String | It specifies a short hint. |
size | null | Integer | It sets number of characters used to determine the width of the input element. |
在下面的示例中,我们正在实现组件。本示例包含以下文件。
// spinner.xhtml
Spinner
// Spinner.java
package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class Spinner {
private int value1;
private int value2;
public int getValue1() {
return value1;
}
public void setValue1(int value1) {
this.value1 = value1;
}
public int getValue2() {
return value2;
}
public void setValue2(int value2) {
this.value2 = value2;
}
}
输出: