The <o:messages> is a component that extends the standard <h:messages> with
the following new features:
for components
Possibility to specify multiple client IDs space separated in the for attribute. The example below
would only display messages for input1 and input3:
<h:form>
<o:messages for="input1 input3" />
<h:inputText id="input1" />
<h:inputText id="input2" />
<h:inputText id="input3" />
<h:inputText id="input4" />
</h:form>
It can even refer non-input components which in turn contains input components. The example below would only display
messages for input1 and input2:
<h:form>
<o:messages for="inputs" />
<h:panelGroup id="inputs">
<h:inputText id="input1" />
<h:inputText id="input2" />
</h:panelGroup>
<h:inputText id="input3" />
<h:inputText id="input4" />
</h:form>
You can even combine them. The example below would only display messages for input1,
input2 and input4.
<h:form>
<o:messages for="inputs input4" />
<h:panelGroup id="inputs">
<h:inputText id="input1" />
<h:inputText id="input2" />
</h:panelGroup>
<h:inputText id="input3" />
<h:inputText id="input4" />
</h:form>
Show a single custom message whenever the component has received any faces message. This is particularly useful
when you want to display a global message in case any of the in for specified components has a faces
message. For example:
<o:messages for="form" message="There are validation errors. Please fix them." />
<h:form id="form">
<h:inputText id="input1" /><h:message for="input1" />
<h:inputText id="input2" /><h:message for="input2" />
<h:inputText id="input3" /><h:message for="input3" />
</h:form>
Control HTML escaping by the escape attribute.
<o:messages escape="false" />
Beware of potential XSS attack holes when user-controlled input is redisplayed through messages!
Control iteration markup fully by the var attribute which sets the current FacesMessage
in the request scope and disables the default table/list rendering. For example,
<dl>
<o:messages var="message">
<dt>#{message.severity}</dt>
<dd title="#{message.detail}">#{message.summary}</dd>
</o:messages>
</dl>
Note: the iteration is by design completely stateless. It's therefore not recommended to nest form components inside
the <o:messages> component. It should be used for pure output only, like as the standard
<h:messages>. Plain output links are however no problem. Also note that the message
and escape attributes have in this case no effect. With a single message, there's no point of
iteration. As to escaping, just use <h:outputText escape="false"> the usual way.
The component class is named OmniMessages instead of Messages to avoid
confusion with the Messages utility class.
| Info | Value |
|---|---|
| Component Type | org.omnifaces.component.messages.OmniMessages |
| Handler Class | None |
| Renderer Type | org.omnifaces.Messages |
| Description | None |
| Name | Required | Type | Description |
|---|---|---|---|
binding | false | jakarta.el.ValueExpression
(must evaluate to jakarta.faces.component.UIComponent)
| The ValueExpression linking this component to a property in a backing bean. |
dir | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left). |
errorClass | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style class to apply to any message with a severity class of "ERROR". |
errorStyle | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style(s) to apply to any message with a severity class of "ERROR". |
escape | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Whether the message detail and summary should be HTML-escaped. Defaults to true. |
fatalClass | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style class to apply to any message with a severity class of "FATAL". |
fatalStyle | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style(s) to apply to any message with a severity class of "FATAL". |
for | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| Client identifier of the component for which to display messages. This attribute is mutually exclusive with globalOnly and take precedence if used. |
globalOnly | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating that only global messages (that is, messages not associated with any client identifier) are to be displayed. Default value is "false". |
id | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
infoClass | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style class to apply to any message with a severity class of "INFO". |
infoStyle | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style(s) to apply to any message with a severity class of "INFO". |
lang | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| Code describing the language used in the generated markup for this component. |
layout | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The type of layout markup to use when rendering error messages. Valid values are "table" (an HTML table) and "list" (an HTML list). If not specified, the default value is "list". |
message | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The single INFO message to be shown instead when this component has any faces message. |
redisplay | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether already-handled messages should be redisplayed. The default value is true. |
rendered | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true. |
role | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| Per the WAI-ARIA spec and its relationship to HTML5, every HTML element may have a "role" attribute whose value must be passed through unmodified on the element on which it is declared. |
showDetail | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether the detail portion of displayed messages should be included. Default value is "false". |
showSummary | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether the summary portion of displayed messages should be included. Default value is "true". |
style | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style(s) to be applied when this component is rendered. |
styleClass | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| Space-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. |
title | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| Advisory title information about markup elements generated for this component. |
tooltip | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether the detail portion of the message should be displayed as a tooltip. |
var | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The name of the request attribute which exposes the current faces message in the request scope. This will trigger rendering of markup per faces message instead of per component. |
warnClass | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style class to apply to any message with a severity class of "WARN". |
warnStyle | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| CSS style(s) to apply to any message with a severity class of "WARN". |
Output generated by Vdldoc View Declaration Language Documentation Generator.