Messages are displayed via <tc:messages/> tag.
<tc:messages/>
To create messages, press one of the following buttons. The message will be displayed in the tabgroup.
If you are using ajax, make sure to rerender the <tc:message/> tag.
<tc:message/>
On this tab, you can see how messages are displayed if no attribute are set for the <tc:messages/> tag.
<?xml version="1.0" encoding="UTF-8"?> <!-- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. --> <ui:composition template="/main.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:tc="http://myfaces.apache.org/tobago/component" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"> <ui:param name="title" value="#{demoBundle.messages} <tc:messages>"/> <ui:param name="hideGlobalMessages" value="true"/> <p>Messages are displayed via <code class="language-markup"><tc:messages/></code> tag.</p> <tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png" link="#{demoBundle.tagDocUrl}/#{apiController.currentRelease}/tld/tc/messages.html"/> <tc:section label="Create Message"> <p>To create messages, press one of the following buttons. The message will be displayed in the tabgroup.</p> <p>If you are using ajax, make sure to rerender the <code class="language-markup"><tc:message/></code> tag.</p> <tc:button label="Fatal" action="#{messagesController.createFatalMessage}"/> <tc:button label="Error" action="#{messagesController.createErrorMessage}"/> <tc:button label="Warn" action="#{messagesController.createWarnMessage}"/> <tc:button label="Info" action="#{messagesController.createInfoMessage}"/> <tc:button label="7 Messages" action="#{messagesController.createSevenMessages}"/> <tc:button label="7 Messages (Ajax)" action="#{messagesController.createSevenMessages}"> <f:ajax render="tabGroup"/> </tc:button> <tc:button label="Summary/Details" action="#{messagesController.createSummaryDetailMessages}"/> </tc:section> <tc:tabGroup id="tabGroup" switchType="reloadPage"> <tc:tab label="Without attributes"> <p>On this tab, you can see how messages are displayed if no attribute are set for the <code class="language-markup"><tc:messages/></code> tag.</p> <tc:messages/> </tc:tab> <tc:tab label="Number of messages"> <p>A limit for the number of messages can be set with the <code>maxNumber</code> attribute.</p> <pre><code class="language-markup"><tc:messages maxNumber="2"/></code></pre> <tc:messages maxNumber="2"/> </tc:tab> <tc:tab label="Severity"> <p>The range, which severities are displayed, can be set with <code>minSeverity</code> and <code>maxSeverity</code>. In this example, only warnings and error should be displayed.</p> <pre><code class="language-markup"><tc:messages minSeverity="#{messagesController.severityWarn}" maxSeverity="#{messagesController.severityError}"/></code></pre> <tc:messages minSeverity="#{messagesController.severityWarn}" maxSeverity="#{messagesController.severityError}"/> </tc:tab> <tc:tab label="Details"> <p>A message can also contain 'details', you can show it with <code>showDetail</code>.</p> <pre><code class="language-markup"><tc:messages showDetail="true"/></code></pre> <tc:messages showDetail="true"/> </tc:tab> <tc:tab label="Hide summary"> <p>In this example, only the details are shown. To hide the summary, use <code>showSummary</code>.</p> <pre><code class="language-markup"><tc:messages showSummary="false" showDetail="true"/></code></pre> <tc:messages showSummary="false" showDetail="true"/> </tc:tab> <tc:tab label="Order"> <tc:segmentLayout medium="6seg 6seg"> <tc:box label="severity"> <p>By default, messages are sorted by severity. Therefor, the <code>orderBy</code> attribute is not needed in this case.</p> <pre><code class="language-markup"><tc:messages orderBy="severity"/></code></pre> <tc:messages orderBy="severity"/> </tc:box> <tc:box label="occurrence"> <p>Messages displayed in the order they occurred.</p> <pre><code class="language-markup"><tc:messages orderBy="occurrence"/></code></pre> <tc:messages orderBy="occurrence"/> </tc:box> </tc:segmentLayout> </tc:tab> </tc:tabGroup> </ui:composition>