📜  RichFaces Rich:Messages

📅  最后修改于: 2021-01-08 12:45:50             🧑  作者: Mango

RichFaces

该组件的工作方式与组件类似,并在Ajax请求后自动呈现。用于集中显示当前网页的所有验证消息。

对于基本用法,它不需要任何其他属性。为了将消息限制为特定的组件,我们可以使用for属性来引用该组件。

样式类和皮肤参数

下表包含消息的样式类和相应的外观参数。

Class (selector) Function Skin Parameters Mapped CSS properties
.rf-msgs It is used to define styles for the message itself. generalFamilyFont
generalSizeFont
font-family
font-size
.rf-msgs-err It is used to define styles for an error message. errorColor color
.rf-msgs-ftl It is used to define styles for a fatal message. errorColor color/td>
.rf-msgs-inf It is used to define styles for an information message. generalTextColor color
.rf-msgs-wrn It is used to define styles for a warning message. warningTextColor color
.rf-msgs-ok It is used to define styles for a basic OK message. generalTextColor color
.rf-msgs-sum, .rf-msgs-det These classes define styles for the summary or details of a message. No skin parameters.

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

JSF文件

// rich-messages.xhtml




Rich Messages 









托管豆

// User.java

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class User {
String name;
String email;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}

输出: