messages rich:messages HtmlMessages

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

## Creating the Component with a Page Tag

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

Example:

    ...
     	<rich:messages/>
    ...

## Creating the Component Dynamically Using Java

Example:

    import  org.richfaces.component.html.HtmlRichMessages;
    ...
    HtmlRichMessages myMessages = new HtmlRichMessages();
    ...

## Details of Usage

The component has the same behavior as standard <h:message> component except next features:

- It's ajaxRendered. It means that the component is reRendered after Ajax request automatically without outputPanel usage.
- The component optionally provides "passed" state which will be shown if no message to be displayed.
- Provides possibility to add some marker to message. By default, a marker element isn't shown.

The component provides two parts to be optionally defined: marker and informational label before the marker for every message.

Set of facet which can be used for a marker defining:

- passedMarker. This facet is provided to allow setting a marker to be displayed if there is no message.
- errorMarker. This facet is provided to allow setting a marker to be displayed if there is a message with a severity class of "ERROR".
- fatalMarker. This facet is provided to allow setting a marker to be displayed if there is a message with a severity class of "FATAL".
- infoMarker. This facet is provided to allow setting a marker to be displayed if there is a message with a severity class of "INFO".
- warnMarker. This facet is provided to allow setting a marker to be displayed if there is an message with a severity class of "WARN".

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

Example:

    ...
        <rich:messages layout="table" tooltip="true" showDetail="false" showSummary="true" passedLabel="No Errors" var="messages">
            <f:facet name="errorMarker">
                <h:graphicImage url="/image/error.gif"/>
            </f:facet>
            <f:facet name="infoMarker">
                <h:graphicImage url="/image/info.gif"/>
            </f:facet>
            <f:facet name="passedMarker">
                <h:graphicImage url="/image/passed.gif"/>
            </f:facet>
        </rich:messages>
    ...

## 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.

## Definition of Custom Style Classes

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

Classes names

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 and define necessary properties in them.

To change styles of particular <rich:messages> components, define your own style classes in the corresponding <rich:messages> attributes.

## Relevant Resources Links

Here you can see the example of <rich:messages> usage and sources for the given example.