JBoss.orgCommunity Documentation

6.61.  < rich:message >

The component is used for rendering a single message for a specific component.


Table 6.289. rich : message attributes

Attribute NameDescription
ajaxRenderedDefine, 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.
bindingThe attribute takes a value-binding expression for a component property of a backing bean
errorClassCSS style class to apply to any message with a severity class of "ERROR"
errorLabelClassCSS style class to apply to any message label with a severity class of "ERROR"
errorMarkerClassCSS style class to apply to any message marker with a severity class of "ERROR"
fatalClassCSS style class to apply to any message with a severity class of "FATAL"
fatalLabelClassCSS style class to apply to any message label with a severity class of "FATAL"
fatalMarkerClassCSS style class to apply to any message marker with a severity class of "FATAL"
forClient identifier of the component for which to display messages
idEvery component may have a unique id that is automatically created if omitted
infoClassCSS style class to apply to any message with a severity class of "INFO"
infoLabelClassCSS style class to apply to any message label with a severity class of "INFO"
infoMarkerClassCSS style class to apply to any message marker with a severity class of "INFO"
keepTransientFlag for mark all child components to non-transient. If "true", all children components will be set to non-transient state and keep in saved components tree. For output in self-renderer region all content (By default, all content in <f:verbatim> tags and non-jsf elements in facelets, marked as transient - since, self-rendered ajax regions don't plain output for ajax processing).
labelClassCSS style class to apply to label
levelA comma-separated list of messages categories which should be displayed. Default value is "ALL".
markerClassCSS style class to apply to marker
markerStyleCSS style(s) is/are to be applied to marker when this component is rendered
passedLabelAttribute should define the label to be displayed when no message appears
renderedIf "false", this component is not rendered
showDetailFlag indicating whether the summary portion of displayed messages should be included. Default value is "true".
showSummaryFlag indicating whether the summary portion of displayed messages should be included. Default value is "false".
styleThe CSS style for message
styleClassSpace-separated list of CSS style class(es) to be applied when this element is rendered. This value must be passed through as the "class" attribute on generated markup
titleAdvisory title information about markup elements generated for this component
tooltipFlag indicating whether the detail portion of the message should be displayed as a tooltip. Default value is "false".
warnClassCSS style class to apply to any message with a severity class of "WARN"
warnLabelClassCSS style class to apply to any message label with a severity class of "WARN"
warnMarkerClassCSS style class to apply any message marker with a severity class of "WARN"

Table 6.290. Component identification parameters

NameValue
component-typeorg.richfaces.component.RichMessage
component-classorg.richfaces.component.html.HtmlRichMessage
component-familyorg.richfaces.component.RichMessage
renderer-typeorg.richfaces.renderkit.html.RichMessagesHtmlBaseRenderer
tag-classorg.richfaces.taglib.RichMessageTag

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

Example:


...
    <rich:message for="id"/>
...

Example:

import org.richfaces.component.html.HtmlRichMessage;

...
HtmlRichMessage myMessage = new HtmlRichMessage();
...

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

A set of facets which can be used for marker defining:

The following example shows different variants for component customization. The attribute "passedLabel" is used for definition of the label to display when no message appears. But the message component doesn't appear before the form submission even when state is defined as passed (on initial rendering). Boolean attribute "showSummary" defines possibility to display summary portion of displayed messages. The facets "errorMarker" and "passedMarker" set corresponding images for markers.

Example:


...
        <rich:message for="id" passedLabel="No errors' showSummary="true">
            <f:facet name="errorMarker">
                <h:graphicImage url="/image/error.png"/>
            </f:facet>
            <f:facet name="passedMarker">
                <h:graphicImage url="/image/passed.png"/>
            </f:facet>      
        </rich:message>     
...

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:message> components at once, you should only add to your style sheets style classes used by a <rich:message> component.

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



In order to redefine styles for all <rich:message> 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-message-label{
    
font-style:italic
}
...

This is a result:


In the example the font style for message was changed.

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

Example:


...
.myClass{
    
font-weight:bold;
}
...

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

Example:


<rich:message ... styleClass="myClass"/>

This is a result:


As it could be seen on the picture above, the font weight for message was changed.

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