<o:messages>
is a component that extends the standard <h:messages>
with
the following new features:
for
componentsfor
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>
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>
escape
attribute.
<o:messages escape="false" />
Beware of potential XSS attack holes when user-controlled input is redisplayed through messages!
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.
Design notice: 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 |
---|---|---|---|
id | false | javax.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. |
binding | false | javax.el.ValueExpression
(must evaluate to javax.faces.component.UIComponent )
|
The ValueExpression linking this component to a property in a backing bean.
|
rendered | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. Default value is "true". |
globalOnly | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating that only global messages (that is, messages not associated with any client identifier) are to be displayed. Default value is "false". |
for | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| The space separated collection of client IDs of UI input components whose messages needs to be displayed. It is also possible to specify the client ID of a parent component containing UI input components of interest. This attribute is ignored when the globalOnly attribute is set to "true". |
redisplay | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating whether the message should be redisplayed if already displayed by another message(s) component beforehand. Default value is "true". |
var | false | javax.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 without any HTML markup and delegate the markup control to the developer like as ui:repeat. |
message | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| The single INFO message to be shown instead when this component has any faces message. This attribute is ignored when the var attribute is specified. |
layout | false | javax.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 unordered list). Default value is "list". This attribute is ignored when the var attribute is specified. |
title | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| The tooltip to be applied on the of HTML table or ul when this component is rendered. This attribute is ignored when the var attribute is specified. |
showSummary | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating whether the summary portion of displayed messages should be included. Default value is "true". This attribute is ignored when the var attribute is specified. |
showDetail | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating whether the detail portion of displayed messages should be included. Default value is "false". This attribute is ignored when the var attribute is specified. |
tooltip | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating whether the detail portion of the message should be displayed as a tooltip. Default value is "false". This attribute is ignored when the var or title attribute is specified. |
escape | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating that characters in summary and detail that are sensitive in HTML and XML markup must be escaped. Default value is "true". This attribute is ignored when the var attribute is specified. |
style | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style(s) to be applied on the HTML table or HTML ul when this component is rendered. This attribute is ignored when the var attribute is specified. |
styleClass | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Space-separated list of CSS style class(es) to be applied on the HTML table or ul when this component is rendered. This value must be passed through as the "class" attribute on generated markup. This attribute is ignored when the var attribute is specified. |
infoStyle | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style(s) to apply to HTML tr or li with any message with a severity class of "INFO". This attribute is ignored when the var attribute is specified. |
infoClass | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style class to apply to HTML tr or li with any message with a severity class of "INFO". This attribute is ignored when the var attribute is specified. |
warnStyle | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style(s) to apply to HTML tr or li with any message with a severity class of "WARN". This attribute is ignored when the var attribute is specified. |
warnClass | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style class to apply to HTML tr or li with any message with a severity class of "WARN". This attribute is ignored when the var attribute is specified. |
errorStyle | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style(s) to apply to HTML tr or li with any message with a severity class of "ERROR". This attribute is ignored when the var attribute is specified. |
errorClass | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style class to apply to HTML tr or li with any message with a severity class of "ERROR". This attribute is ignored when the var attribute is specified. |
fatalStyle | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style(s) to apply to HTML tr or li with any message with a severity class of "FATAL". This attribute is ignored when the var attribute is specified. |
fatalClass | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| CSS style class to apply to HTML tr or li with any message with a severity class of "FATAL". This attribute is ignored when the var attribute is specified. |
lang | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| Code describing the language used in the generated markup for this component. This attribute is ignored when the var attribute is specified. |
dir | false | javax.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). This attribute is ignored when the var attribute is specified. |
Output generated by Vdldoc View Declaration Language Documentation Generator.