Primefaces消息、消息和增长组件示例
信息通常用于通知、告知和使用户了解他们所完成的操作。通常,消息用于显示信息、错误、警告等。Primefaces等JSF实现提供了不同类型的组件,用于执行此操作。消息、信息和growl是用于此目的的唯一组件。本教程将帮助您将这些组件集成到您的应用程序中。
Primefaces 消息基本信息
消息是标准JSF消息组件的预设扩展版本。
Tag | message |
---|---|
Component Class | org.primefaces.component.message.Message |
Component Type | org.primefaces.component.Message |
Component Family | org.primefaces.component |
Renderer Type | org.primefaces.component.MessageRenderer |
Renderer Class | org.primefaces.component.message.MessageRenderer |
PrimeFaces 的消息属性
Name | Default | Type | Description |
---|---|---|---|
id | null | String | Unique identifier of the component. |
rendered | true | Boolean | Boolean value to specify the rendering of the component, when set to false component will not be rendered. |
binding | null | Object | An el expression that maps to a server side UIComponent instance in a backing bean. |
showSummary | false | Boolean | Specifies if the summary of the FacesMessage should be displayed. |
showDetail | true | Boolean | Specifies if the detail of the FacesMessage should be displayed. |
for | null | String | Id of the component whose messages to display. |
redisplay | true | Boolean | Defines if already rendered messages should be displayed |
display | both | String | Defines the display mode. |
escape | true | Boolean | Defines whether html would be escaped or not. |
severity | null | String | Comma separated list of severities to display only. |
style | null | String | Inline style of the component. |
styleClass | null | String | Style class of the component. |
开始使用Primefaces消息
通常情况下,要向应用程序添加消息,您需要将FacesMessage实例添加到您自己的FacesContext实例中,在RenderResponse阶段之后呈现。许多这些消息是手动添加的,同时其他消息由jsf实现添加。当您处理验证和转换时,会显示许多实际上不是您代码的一部分的消息。以下示例显示了一个简单的验证过程示例,该示例在提交未填写所需输入的表单时生成一个错误消息。index.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:outputPanel>
<p:outputLabel value="Typing of your message is mandatory:"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}" required="true"/>
<p:message id="message" for="input"></p:message>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action" action="#{messageManagedBean.doSomeAction}" update="input message"></p:commandButton>
</h:form>
</html>
消息管理Bean.java
package com.Olivia;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeAction(){
return "";
}
}
以下是对上述代码的详细解释:
- The rendered message isn’t part of your code, it’s queued by the jsf implementation through executing of ProcessValidation phase.
- RenderResponse phase is responsible of getting messages displayed.
- Queuing messages require to pass through jsf lifecycle. Normal starting of jsf lifecycle get done by activating an action.
- To ensure that certain input is required, required attribute must be set to true. ProcessValidation will look at your required components and queuing messages in case some of them are missed up.
- Message component used mainly for associating specific component with a message. Typically, this message will always be used for displaying all messages for accompanying component.
- The association between the message and it’s relevant component get achieved by providing for attribute.
Primefaces信息显示模式
消息组件有三种不同的显示模式。
- text: Only message text is displayed.
- icon: Only message severity is displayed and message text is visible as a tooltip.
- both (default): Both icon and text are displayed.
让我们将之前介绍的相同示例改为自行控制使用哪种显示模式。index.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:outputPanel>
<p:outputLabel value="Typing of your message is mandatory:"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}" required="true"/>
<p:message id="message" for="input" display="icon"></p:message>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action" action="#{messageManagedBean.doSomeAction}" update="input message"></p:commandButton>
</h:form>
</html>
Primefaces 消息基本信息
Messages 是标准 JSF messages 组件的预定义扩展版本。
Tag | messages |
---|---|
Component Class | org.primefaces.component.messages.Messages |
Component Type | org.primefaces.component.Messages |
Component Family | org.primefaces.component |
Renderer Type | org.primefaces.component.MessagesRenderer |
Renderer Class | org.primefaces.component.messages.MessagesRenderer |
Primefaces 的消息属性
Name | Default | Type | Description |
---|---|---|---|
id | null | String | Unique identifier of the component. |
rendered | true | Boolean | Boolean value to specify the rendering of the component, when set to false component will not be rendered. |
binding | null | Object | An el expression that maps to a server side UIComponent instance in a backing bean. |
showSummary | true | Boolean | Specifies if the summary of the FacesMessages should be displayed. |
showDetail | false | Boolean | Specifies if the detail of the FacesMessages should be displayed. |
globalOnly | false | String | When true, only facesmessages with no clientIds are displayed. |
redisplay | true | Boolean | Defines if already rendered messages should be displayed |
autoUpdate | false | Boolean | Enables auto update mode if set true. |
for | null | String | Name of associated key, takes precedence when used with globalOnly. |
escape | true | Boolean | Defines whether html would be escaped or not. |
severity | null | String | Comma separated list of severities to display only. |
closable | false | Boolean | Adds a close icon to hide the messages. |
style | null | String | Inline style of the component. |
styleClass | null | String | Style class of the component. |
showIcon | true | Boolean | Defines if severity icons would be displayed. |
开始使用Primefaces消息功能
提到使用p:messages时,重要的是要知道这个组件用于显示页面上不属于特定控件的一般消息。下面的示例展示了如何使用p:messages来显示一般消息。index2.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:messages id="messages"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action"
action="#{messageManagedBean.doSomeAction}" update="messages"></p:commandButton>
</h:form>
</html>
消息管理Bean.java
package com.Olivia;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message ="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeAction(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Empty value isn't accepted","Empty value isn't accepted"));
}
else if(this.message.equals("") == false){
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "You entered value","You entered value"));
}
return "";
}
}
以下是之前发生的事情的详细解释:
- Messages component used mainly for general message coverage.
- You can add a message by creating an instance of FacesMessage that’s comprised from message’s severity, message detail section and message summary section. After finish the creation of message, it’s required for displaying adding it into your FacesContext. RenderResponse will display it into your page.
严重程度
在以前探索的例子中,你提供了两个具有错误严重程度的消息,这些消息会在页面上呈现出来。重要的是要知道,你可以控制p:messages组件显示哪种类型的消息。通过提供以逗号分隔的info、warn、error、fatal值的severity属性,你可以控制显示哪些消息。index3.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:messages id="messages" severity="fatal,info,warn"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action"
action="#{messageManagedBean.doSomeAction}" update="messages"></p:commandButton>
</h:form>
</html>
MessageManagedBean.java的汉语本地化写法。
package com.Olivia;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message ="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeAction(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error Message","Error Message"));
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_FATAL, "Fatal Message","Fatal Message"));
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_WARN, "WARN Message","WARN Message"));
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO, "INFO Message","INFO Message"));
}
return "";
}
}
自动更新
如果您在之前探索了所有提供的示例,您一定会注意到p:commandButton已经异步更新了message/messages组件。您可以避免这样的安排,特别是对于具有分层机构的页面。让我们拥有一个包含一个messages组件的模板页面,用于显示应用程序抛出的所有通用消息。index4.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:messages id="messages" autoUpdate="true"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action"
action="#{messageManagedBean.doSomeAction}"></p:commandButton>
</h:form>
</html>
消息管理类.java
package com.Olivia;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message ="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeAction(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error Message","Error Message"));
}
return "";
}
}
- Developed command action hasn’t provided update attribute. Even though update attribute isn’t there, yet the message has been displayed cause the autoUpdate is used by the messages component itself.
可以被定向发送的信息
可以通过特定的消息组件来控制消息的显示。我们使用两个不同的消息组件 {A 和 B} 和两个不同的输入组件 {1 和 2}。对于输入数字 1,消息将显示在消息 A 中,对于数字 2,将使用消息 B。以下示例展示了这种使用方式的影响。index5.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:messages for="input1" id="messagesA"/>
<p:messages for="input2" id="messagesB"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input1" value="#{messageManagedBean.message}"/>
<h:inputText id="input2" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeActionOne}" update="messagesA messagesB"></p:commandButton>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action Two"
action="#{messageManagedBean.doSomeActionTwo}" update="messagesA messagesB"></p:commandButton>
</h:form>
</html>
消息ManagedBean.java
package com.Olivia;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message ="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeActionOne(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage("form:input1",
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error Message For Input1","Error Message For Input1"));
}
return "";
}
public String doSomeActionTwo(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage("form:input2",
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error Message For Input2","Error Message For Input2"));
}
return "";
}
}
请用中文将以下句子改写,只需要一个选项:
“Can you help me with this task?”
- Featuring Target Messages requires associate your messages component with a component using for attribute and providing clientId for all of those messages that are added into FacesContext.
请注意,jsf实现已经为其组件分配了唯⼀标识符。这些标识符采⽤FormId:componentId的形式。您可以通过将form组件的prependId设置为false来禁⽤此标识。因此,每个组件实际上只使⽤其componentId来标识。对于那些未标识的组件,它们将使⽤随机标识(如j_id4)来标识。
基本信息界面的 Primefaces Growl
Growl是基于Mac的growl通知小部件开发的,用于在叠加层中显示FacesMessages,就像消息和消息组件一样。
Tag | Growl |
---|---|
Component Class | org.primefaces.component.growl.Growl |
Component Type | org.primefaces.component.Growl |
Component Family | org.primefaces.component |
Renderer Type | org.primefaces.component.GrowlRenderer |
Renderer Class | org.primefaces.component.growl.GrowlRenderer |
Primefaces Growl特性
Name | Default | Type | Description |
---|---|---|---|
id | null | String | Unique identifier of the component |
rendered | true | Boolean | Boolean value to specify the rendering of the component, when set to false component will not be rendered. |
binding | null | Object | An el expression that maps to a server side UIComponent instance in a backing bean |
sticky | false | Boolean | Specifies if the message should stay instead of hidden automatically. |
showSummary | true | Boolean | Specifies if the summary of message should be displayed. |
showDetail | false | Boolean | Specifies if the detail of message should be displayed. |
globalOnly | false | Boolean | When true, only facesmessages without clientids are displayed. |
life | 6000 | Integer | Duration in milliseconds to display non-sticky messages. |
autoUpdate | false | Boolean | Specifies auto update mode. |
redisplay | true | Boolean | Defines if already rendered messaged should be displayed. |
for | null | String | Name of associated key, takes precedence when used with globalOnly. |
escape | true | Boolean | Defines whether html would be escaped or not. |
severity | null | String | Comma separated list of severities to display only. |
开始使用Primefaces Growl
Growl组件与之前讨论的消息组件没有太大的区别,因此您可以依赖它们来提供“可定位的消息”和“严重级别”选项。以下示例向您展示了Growl组件的最简单的例子。index6.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:growl id="message"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeAction}" update="message"></p:commandButton>
</h:form>
</html>
消息ManagedBean.java
package com.Olivia;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message ="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeAction(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error Message Displayed Growl","Error Message Displayed Growl"));
}
return "";
}
}
Primefaces消息的寿命
每条消息将会显示6000毫秒,然后隐藏,您可以控制Growl消息保持粘性,这意味着它不会自动隐藏。index7.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:growl id="message" sticky="true"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeAction}" update="message"></p:commandButton>
</h:form>
</html>
如果你想让你的Growl消息具有粘性,你还可以通过调整生命周期属性来控制消息的显示时间。index8.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:growl id="message" life="2000"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeAction}" update="message"></p:commandButton>
</h:form>
</html>
Primefaces增强的消息定位功能
您还可以控制Growl消息所呈现的位置。默认情况下,Growl消息位于右上角,位置可以通过名为ui-growl的CSS选择器来控制。 index9.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
<style>
.ui-growl {
left:700px;
}
</style>
</h:head>
<h:form id="form">
<p:growl id="message"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeAction}" update="message"></p:commandButton>
</h:form>
</html>
逃避
有关Primefaces消息组件(消息、消息列表和growl)的所有内容,默认情况下,它们会转义所有的HTML内容。如果您需要通过Primefaces消息组件显示HTML内容,请将转义设置为false。 index10.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:messages id="message" escape="false"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeAction}" update="message"></p:commandButton>
</h:form>
</html>
信息ManagedBean.java
package com.Olivia;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class MessageManagedBean {
private String message ="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String doSomeAction(){
if(this.message.equals("")){
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "<i>Error Message Displayed</i>","<i>Error Message Displayed</i>"));
}
return "";
}
}
详情和摘要信息部分
显示消息的部分可以被控制,所以你可以选择需要显示的消息部分。所有的FacesMessage包含了Summary和Detail部分,一旦消息被添加到FacesContext中就会提供这两个部分。Primefaces的所有消息组件默认渲染Summary部分。你可以通过提供showSummary和showDetail来显示FacesMessage的两个部分。index11.xhtml
<html xmlns="https://www.w3.org/1999/xhtml"
xmlns:ui="https://java.sun.com/jsf/facelets"
xmlns:h="https://java.sun.com/jsf/html"
xmlns:f="https://java.sun.com/jsf/core"
xmlns:p="https://primefaces.org/ui">
<h:head>
<script name="jquery/jquery.js" library="primefaces"></script>
</h:head>
<h:form id="form">
<p:messages id="message" showDetail="true" showSummary="true" escape="false"/>
<p:outputPanel>
<p:outputLabel value="Typing of your preferred technical site"></p:outputLabel>
</p:outputPanel>
<h:inputText id="input" value="#{messageManagedBean.message}"/>
<p:commandButton value="Execute JSF Lifecycle - Invoke Action One"
action="#{messageManagedBean.doSomeAction}" update="message"></p:commandButton>
</h:form>
</html>
Primefaces 提示信息增长汇总
消息在广泛发布的各种应用程序中被广泛使用。Primefaces为您提供了多种组件,可用于在应用程序中进行信息通知和显示信息文本。通过在下方留言并查找源代码来为我们做出贡献。
下载PrimeFaces Messages项目。