RichFaces rich:message

RichFaces Rich Message 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:message

RichFaces rich:message

This component is used to render a message. We can customize apppearance of this message. The tool-tip attrubute is used to provide further information about the message.

This component is same as the JSF <h:message> with some additional attributes.

Style classes and skin parameters

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

Example

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

JSF File

// rich-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 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>  
  20. <rich:message for="user-name" ajaxRendered="true"/>  
  21. <h:commandButton value="submit"/>  
  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. }