Documentation
JSFToolbox

Search 

Contents

  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
Selected 12. JSF Tag Reference

10. JSF HTML Tag Reference

Contents > JSF HTML Tag Reference > h:messages

h:messages

The messages tag renders all message for the current view. You can customize the messages generated by this component by applying different CSS styles depending on the severity level of the messages (eg. red for error, green for information) as well as changing the detail level of the messages.

Example

<h:form id="form">
  <h:inputText id="username" required="#{true}" value="#{userBean.user.username}" /><br />
  <h:inputSecret id="password" required="#{true}" value="#{userBean.user.password}" /><br />
  <h:commandButton id="submit" /><br />
  <h:messages showDetail="#{true}" showSummary="#{false}" />
</h:form>

HTML Output

<form id="form" name="form" method="post" action="/demo/messages.jsp" enctype="application/x-www-form-urlencoded">
  <input id="form:username" name="form:username" type="text" value=""/><br/>
  <input id="form:password" name="form:password" type="password" /><br/>
  <input id="form:submit" name="form:submit" type="submit" onclick="generatedCode();"/><br/>
  <ul> 
    <li>"username": Value is required.</li>
    <li>"password": Value is required.</li>
  </ul>
</form>

The above example demonstrates the result of submitting a form containing two required fields that were intentionally left blank. The resulting messages were generated by the messages tag.

Tag Attributes

binding Expression
 
The value-binding expression linking this component tag to a backing bean property.
errorClass CSS Class
 
The errorClass attribute sets the CSS style class to apply to a message with a severity level of "ERROR".
errorStyle CSS Style
 
The errorStyle attribute sets the CSS style or styles to apply to a message with a severity level of "ERROR".
fatalClass CSS Class
 
The fatalClass attribute sets the CSS style class to apply to a message with a severity level of "FATAL".
fatalStyle CSS Style
 
The fatalStyle attribute sets the CSS style or styles to apply to a message with a severity level of "FATAL".
globalOnly Boolean
 
The globalOnly attribute is a boolean flag that indicates whether or not to display only global messages that are not associated with any specific components. The default value is "false".
id Text
 
The unique identifier value for this component. The value must be unique within the closest naming container.
infoClass CSS Class
 
The infoClass attribute sets the CSS style class to apply to a message with a severity level of "INFO".
infoStyle CSS Style
 
The infoStyle attribute sets the CSS style or styles to apply to a message with a severity level of "INFO".
layout Text
 
The layout attribute sets the layout to use for displaying messages. The valid values for this attribute are "table" and "list". The table layout uses an HTML table to display messages, while the list layout uses a bulleted list. The default value is "list".
rendered Boolean
 
A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered.
showDetail Boolean
 
The showDetail attribute is a boolean flag indicating whether the detail part of the message should be included. The default value is "true".
showSummary Boolean
 
The showSummary attribute is a boolean flag indicating whether the summary part of the message should be included. The default value is "false".
style CSS Style
 
The style attribute sets the CSS style definition to be applied to this component when it is rendered.
styleClass CSS Class
 
The styleClass attribute sets the CSS class to apply to this component when it is rendered.
title Text
 
The title attribute is a standard HTML attribute that sets the tooltip text to display for the rendered component.
tooltip Text
 
The tooltip attribute is a boolean flag indicating whether the detail part of the message should be displayed as a tooltip.
warnClass CSS Class
 
The warnClass attribute sets the CSS style class to apply to a message with a severity level of "WARN".
warnStyle CSS Style
 
The warnStyle attribute sets the CSS style or styles to apply to a message with a severity level of "WARN".