Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
Documentation
Search
  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
  12. JSF Tag Reference
JSF HTML Tag Library
  h:body
  h:button
  h:column
  h:commandButton
  h:commandLink
  h:dataTable
  h:form
  h:graphicImage
  h:head
  h:inputHidden
  h:inputSecret
  h:inputText
  h:inputTextarea
  h:link
  h:message
Selected h:messages
  h:outputFormat
  h:outputLabel
  h:outputLink
  h:outputScript
  h:outputStylesheet
  h:outputText
  h:panelGrid
  h:panelGroup
  h:selectBooleanCheckbox
  h:selectManyCheckbox
  h:selectManyListbox
  h:selectManyMenu
  h:selectOneListbox
  h:selectOneMenu
  h:selectOneRadio
If you like this documentation, please take a look at my book:

12. JSF HTML Tag Reference

Documentation > JSF > JSF Tag Reference > JSF HTML Tag Library > h:messages

h:messages

The messages tag renders all Faces messages 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. The messages tag supports two layouts for the generated messages:an HTML table or a bulleted list. The default layout is the list format. You can also customize the standard error messages by overriding specific JSF properties in your message bundle.

JSF Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html">
<h:head />
<body>
<h:form>
	<h:messages errorStyle="color:red" />
	<h:inputText required="true" label="My Input" />
	<h:commandButton value="Click" />
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

Rendered Output

Rendered h:messages tag

Tag Attributes

binding Expression
 
The value-binding expression linking this component tag to a backing bean property.
dir Enumerated
 
The dir attribute is a standard HTML attribute that overrides the default text directionality for this component. The values accepted for this component are "LTR" (left-to-right) and "RTL" (right-to-left).

This attribute accepts the following values:

  • LTR
  • RTL
errorClass Text
 
The errorClass attribute sets the CSS style class to apply to a message with a severity level of "ERROR".
errorStyle Text
 
The errorStyle attribute sets the CSS style or styles to apply to a message with a severity level of "ERROR".
fatalClass Text
 
The fatalClass attribute sets the CSS style class to apply to a message with a severity level of "FATAL".
fatalStyle Text
 
The fatalStyle attribute sets the CSS style or styles to apply to a message with a severity level of "FATAL".
for Text
 
Client identifier of the component for which to display messages. This attribute is mutually exclusive with globalOnly and take precedence if used.
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 Text
 
The infoClass attribute sets the CSS style class to apply to a message with a severity level of "INFO".
infoStyle Text
 
The infoStyle attribute sets the CSS style or styles to apply to a message with a severity level of "INFO".
lang Text
 
The lang attribute is a standard HTML attribute that sets the code describing the language to be used in the markup generated by this component.
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 Text
 
The style attribute sets the CSS style definition to be applied to this component when it is rendered.
styleClass Text
 
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 Text
 
The warnClass attribute sets the CSS style class to apply to a message with a severity level of "WARN".
warnStyle Text
 
The warnStyle attribute sets the CSS style or styles to apply to a message with a severity level of "WARN".