📜  Primefaces Inputtextarea

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

PrimeFaces InputTextarea

PrimeFaces提供了组件,用于在JSF应用程序中创建文本区域。它是标准inputTextarea的扩展。它包括各种功能,例如:autoComplete,autoResize等。

它还显示剩余字符信息。

InputTextarea属性

下表包含InputTextarea组件的属性。

Attribute Default value Return type Description
id null String It is an unique identifier of the component.
rendered true Boolean It renders boolean value to specify the rendering of the component.
binding null Object It is used to set an el expression that maps to a server side UIComponent
instance in a backing bean.
value null Object It is used to hold value of the component.
converter null Converter/String An el expression or a literal text that defines a converter
for the component.
immediate false Boolean It is used to set boolean value.
required false Boolean It is used to make a component required.
validator null Method Expr It is a method binding expression that refers to a method
validation.
valueChangeListener null Method Expr It is 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.
autocomplete null String It is used to set autocomplete behavior.
size null Integer It is used to set number of characters that determine the width of the input element.
style null String It is used to set in line CSS for the input element.
autoResize true Boolean It is used to set autoResize true or false.

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

JSF文件

// inputTextarea.xhtml





AutoComplete


PrimeFaces Autocomplete TextArea

ManagedBean

// AutoCompleteTextArea.java

package com.javatpoint;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class AutoCompleteTextArea {
public List sugessions(String str) {
List results = new ArrayList<>();
if (str.equals("JavaTpoint")) {
results.add("JavaTpoint is a Tutorial Site.");
results.add("JavaTpoint is good to learn Java.");
results.add("JavaTpoint provides technical tutorials.");
results.add("JavaTpoint is easy to understand.");
results.add("JavaTpoint is developed by Sonoo Jaiswal!");
} else {
results.add("JavaTpoint "+str);
}
return results;
}
}

输出:

当我们开始输入文本区域时,它会显示建议。