📜  Primefaces编辑器

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

PrimeFaces编辑器

PrimeFaces提供了组件,该组件用于在JSF应用程序中创建编辑器。我们可以使用此编辑器来获取大量用户输入。该编辑器提供了可用于格式化输入内容的编辑和格式化工具。我们也可以使用它来发送格式化的电子邮件。它包含下表中列出的丰富属性。

编辑器属性

Attribute Default value Return 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 null Boolean It is used to mark component as required.
validator null Method Expr It is a method expression that refers to a method
validationg the input.
height null Integer It is used to set height of the editor.
width null Integer It is used to set widthit of the editor.
disabled false Boolean It is used to disable editor.
style null String It is used to set inline CSS of the editor container.
onchange null String It is used to execute script when editor data changes.
maxlength null Integer It is used to set maximum length of the raw input.

Ajax行为事件

SelectCeckboxMenu除了常见的dom事件(如change,selectCheckboxMenu)外,还提供Ajax事件。

Style Class Applies
.ui-editor It is used for main container.
.ui-editor-toolbar It applies on toolbar of editor.
.ui-editor-group It applies on button groups.
.ui-editor-button It is used for Each button.
.ui-editor-divider It is used for divider to separate buttons.
.ui-editor-disabled It is used to disable editor controls.
.ui-editor-list It applies on dropdown lists.
.ui-editor-color It applies on color picker.

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

JSF文件

// editor.xhtml





Editor



ManagedBean

//编辑器

package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class Editor {
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

输出: