### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev
- Next

### 6.14.8. < rich:messages > available since 3.1.0

expand all

#### 6.14.8.1. Description

The <rich:messages> component is similar to <rich:message> component but used for rendering all messages for the components.

Figure 6.300. <rich:messages> component

#### 6.14.8.2. Key Features

- Highly customizable look and feel

- Track both traditional and Ajax based requests

- Optional ToolTip to display a detailed part of the messages

- Additionally customizable via attributes and facets

- Additionally provides of three parts to be optionally defined: marker, label and header

Table 6.539. rich : messages attributes

Attribute Name | Description
--- | ---
ajaxRendered | Define, must be (or not) content of this component will be included in AJAX response created by parent AJAX Container, even if not forced by reRender list of ajax action. Ignored if component marked to output by some Ajax action component. The default value is "true".
binding | JSF: The attribute takes a value-binding expression for a component property of a backing bean
errorClass | Assigns one or more space-separated CSS class names to the messages with a severity class of "ERROR"
errorLabelClass | Assigns one or more space-separated CSS class names to the messages labels with a severity class of "ERROR"
errorMarkerClass | Assigns one or more space-separated CSS class names to the messages marker with a severity class of "ERROR"
fatalClass | Assigns one or more space-separated CSS class names to the messages with a severity class of "FATAL"
fatalLabelClass | Assigns one or more space-separated CSS class names to the messages labels with a severity class of "FATAL"
fatalMarkerClass | Assigns one or more space-separated CSS class names to the messages markers with a severity class of "FATAL"
for | Client identifier of the component for which to display messages
globalOnly | Flag indicating that only global messages (that is, messages not associated with any client identifier) are to be displayed. Default value is "false"
id | JSF: Every component may have a unique id that is automatically created if omitted
infoClass | Assigns one or more space-separated CSS class names to the messages with a severity class of "INFO"
infoLabelClass | Assigns one or more space-separated CSS class names to the messages labels with a severity class of "INFO"
infoMarkerClass | Assigns one or more space-separated CSS class names to the messages markers with a severity class of "INFO"
labelClass | Assigns one or more space-separated CSS class names to the messages labels
layout | The type of layout markup to use when rendering error messages. Possible values are "table" (an HTML table), "list" (an HTML list) and iterator. If not specified, the default value is "list".
level | Defines a comma-separated list of messages categories to display. Default value is "ALL".
markerClass | Assigns one or more space-separated CSS class names to the messages markers
markerStyle | CSS style rules to be applied to the messages markers
minLevel | Defines a minimum level of messages categories to display.
rendered | JSF: If "false", this component is not rendered
showDetail | Flag indicating whether the detailed information of displayed messages should be included. Default value is "false"
showSummary | Flag indicating whether the summary portion of displayed messages should be included. Default value is "true"
style | HTML: CSS style rules to be applied to the component
styleClass | JSF: Assigns one or more space-separated CSS class names to the component. Corresponds to the HTML 'class' attribute.
title | HTML: Advisory title information about markup elements generated for this component
tooltip | Flag indicating whether the detail portion of the message should be displayed as a tooltip. Default value is "false".
warnClass | Assigns one or more space-separated CSS class names to the messages with a severity class of "WARN"
warnLabelClass | Assigns one or more space-separated CSS class names to the messages labels with a severity class of "WARN"
warnMarkerClass | Assigns one or more space-separated CSS class names to the messages markers with a severity class of "WARN"

Table 6.540. Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.component.RichMessages
component-class | org.richfaces.component.html.HtmlRichMessages
component-family | org.richfaces.component.RichMessages
renderer-type | org.richfaces.renderkit.html.HtmlRichMessagesRendere
tag-class | org.richfaces.taglib.RichMessagesTag

#### 6.14.8.3. Creating the Component with a Page Tag

To create the simplest variant of message on a page, use the following syntax:

Example:

    ...

    <rich:messages/>

    ...

#### 6.14.8.4. Creating the Component Dynamically Using Java

Example:

    import  org.richfaces.component.html.HtmlRichMessages;

    ...

    HtmlRichMessages myMessages = new HtmlRichMessages();

    ...

#### 6.14.8.5. Details of Usage

The <rich:messages> component is considered as JSF HTML <h:messages> , extended with following features:

- Ajax support (the component does not require to be wrapped in <a4j:outputPanel> in order to be rendered during Ajax requests);

- possibilty to add graphical markers (pictograms) to reinforce a message for both "passed" or "failed" states;

- set of predefined CSS classes for customizing messages appearance.

There are two optional parts that could be defined for every message: marker and text label. The set of facets, which can be used for a marker definition, is shown below:

Table 6.541. Facets

Facet | Description
--- | ---
errorMarker | Defines marker for "Error" message severity class
fatalMarker | Defines marker for "Fatal" message severity class
infoMarker | Defines marker for "Info" message severity class
warnMarker | Defines marker for "Warn" message severity class

The following example shows different variants of customization of the component.

Example:

    <rich:messages layout="table" tooltip="true" showDetail="false" showSummary="true">

          <f:facet name="errorMarker">

                <h:graphicImage url="/image/error.png"/>

          </f:facet>

          <f:facet name="infoMarker">

                <h:graphicImage url="/image/info.png"/>

          </f:facet>

     </rich:messages>

The <rich:messages> component keeps all messages for all components even after only one Ajax-validated component was updated.

#### 6.14.8.6. Look-and-Feel Customization

For skinnability implementation, the components use a style class redefinition method.

There are no skin parameters and default predefined values. To redefine the appearance of all <rich:messages> components at once, you should only add to your style sheets style classes used by a <rich:messages> component.

#### 6.14.8.7. Definition of Custom Style Classes

On the screenshot there are classes names that define styles for component elements.

Figure 6.301. Classes names

Table 6.542. Classes names that define a component appearance

Class name | Description
--- | ---
rich-messages | Defines styles for a wrapper element
rich-messages-marker | Defines styles for a marker
rich-messages-label | Defines styles for a label

In order to redefine styles for all <rich:messages> components on a page using CSS, it's enough to create classes with the same names (possible classes could be found in the tables above) and define necessary properties in them.

Example:

    ...

    .rich-messages-label{

        font-style:italic;

    }

    ...

This is a result:

Figure 6.302. Redefinition styles with predefined classes

In the example the font style for messages was changed.

Also it's possible to change styles of particular <rich:messages> component. In this case you should create own style classes and use them in corresponding <rich:messages> styleClass attributes. An example is placed below:

Example:

    ...

    .myClass{

        color:red;

    }

    ...

The "errorClass" attribute for <rich:messages> is defined as it's shown in the example below:

Example:

    <rich:messages ... errorClass="myClass"/>

This is a result:

Figure 6.303. Redefinition styles with own classes and styleClass attributes

As it could be seen on the picture above, color of messages was changed.

#### 6.14.8.8. Relevant Resources Links

On the component LiveDemo page you can see the example of <rich:messages> usage and sources for the given example.

- Prev6.14.7. < rich:message > ...
- Top of page
- Front page
- Next6.14.9. < rich:jQuery > ...