📜  Primefaces签名

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

PrimeFaces签名

它用于绘制签名作为输入。它提供了一个画布,我们可以在其中绘制签名。它提供了各种选项,例如背景色,前景色,用于自定义的厚度。可以在支持触摸的设备中使用。在JSF应用程序中,我们可以使用组件创建它。它还提供了下表中列出的各种属性。

签名属性

Attribute Default value Type Description
id null String It is used to 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 the component as required.
validator null MethodExpr It is used to set validator.
requiredMessage null String It is used to set message to be displayed when required field
validation fails.
widgetVar null String It is a name of the client side widget.
backgroundColor #ffffff String It is used to set background color.
color #000000 String It is used to set foreground color.
thickness 2 Integer It is used to set thickness of the lines.
style null String It is used to set inline CSS of the component.
readonly false Boolean It is used to make component readonly.
guideline false Boolean It is used to set a guildeline.
guidelineColor #a0a0a0 String It is used to set color of the guideline.
guidelineOffset 25 String It is used to set offset of guideline from bottom.
guidelineIndent 10 Boolean It is used to set guide line indent from the edges.
onchange null String It is used to execute script when signature
changed.
base65Value null String Write-only value used to pass the value in base64
to backing bean.

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

JSF文件

// signature.xhtml





Signature





ManagedBean

// SignatureDemo.java

package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class SignatureDemo {
private String signature;
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
}

输出: