RichFaces rich:notifyMessage

RichFaces NotifyMessage with features, configuration, architecture, a4j:log, a4j:ajax, a4j:commandlink, a4j:outputpanel,rich:autocomplete, rich:fileupload, rich:list, rich:panel, rich:datascroller, rich:dropdownmenu, rich:messages, rich:progressbar, rich:tooltip etc.

RichFaces rich:notifyMessage

RichFaces rich:notifyMessage

It is used to display FacesMessages. This component is built on the top of <rich:notify>.

Style classes and skin parameters

Note - that<rich:notifyMessage> shares common classes with <rich:notify>. since there is exactly one notification rendered for each JSF message.

The following table contains the style classes and corresponding skin parameters for the notifyMessage.

Class Function Skin Parameters Mapped CSS properties
.rf-ntf-inf This class defines styles for an informative message. generalTextColor color
.rf-ntf-wrn This class defines styles for a warning notifications. No skin parameters.  
.rf-ntf-err This class defines styles for a error notifications. No skin parameters.  
.rf-ntf-ftl This class defines styles for a fatal notifications. No skin parameters.  
.rf-ntf-inf .rf-ntf-ico, .rf-ntf-wrn .rf-ntf-ico, .rf-ntf-err .rf-ntf-ico, .rf-ntf-ftl .rf-ntf-ico These classes define style for notification icon based on severity of notification message. No skin parameters.  

Example

Here, in the following example, we are implementing <rich:notifyMessage> component. This example contains the following files.

JSF Page

// rich-notify-message.xhtml

  1. <ui:composition xmlns="http://www.w3.org/1999/xhtml"  
  2. xmlns:h="http://java.sun.com/jsf/html"  
  3. xmlns:a4j="http://richfaces.org/a4j"  
  4. xmlns:rich="http://richfaces.org/rich"  
  5. xmlns:f="http://java.sun.com/jsf/core"  
  6. xmlns:ui="http://java.sun.com/jsf/facelets">  
  7. <f:view>  
  8. <h:head>  
  9. <title>Rich Notify Message </title>  
  10. </h:head>  
  11. <h:body>  
  12. <h:form>  
  13. <h:outputText value="User Name " />  
  14. <h:inputText label="user name"  
  15. id="user-name"  
  16. required="true"  
  17. value="#{user.name}">  
  18. <f:validateLength minimum="5" maximum="20" />  
  19. </h:inputText><br/><br/>  
  20. <h:commandButton value="submit"/>  
  21. <rich:notifyMessage for="user-name"/>  
  22. </h:form>  
  23. </h:body>  
  24. </f:view>  
  25. </ui:composition>  

Managed Bean

// User.java

  1. import javax.faces.bean.ManagedBean;  
  2. import javax.faces.bean.RequestScoped;  
  3. @ManagedBean  
  4. @RequestScoped  
  5. public class User {  
  6. String name;  
  7. public String getName() {  
  8. return name;  
  9. }  
  10. public void setName(String name) {  
  11. this.name = name;  
  12. }  
  13.