This tag is also like message tag which is also used to show all messages for the components. If you want to customize the message then CSS can be used. If you want to show the error message for a component in a color and other information in different color then CSS can be helpful. Two layouts are supported for generated messages, table and list. If layout is not specified then it takes list layout and all messages are displayed in a line.
Code Description :
| <%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <f:view> <html> <body> <h:form >Enter name and password below :<br> <h:inputText id="name" required="true" value="#{MessageBean.a}" /><br><br> <h:inputSecret id="pwd" required="true" value="#{MessageBean.b}" /><br> <h:commandButton id="submit" value="Submit"/><br /> <h:messages showDetail="false" showSummary="true" layout="table"/> </h:form> </body> </html> </f:view> |
Rendered Output :

If these input text field is not filled by the user and submit is pressed then the error messages are flashed for this component to warn that these are the required fields to be filled. It shows that these can't be left blank because "required" field is set to "true" for these fields. So the output is shown below if these fields are not filled :

Html Source Code :
</form> |
This messages tag contains most of the attributes common to the message tag. Only few are different like layout attribute. All are summarized below :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: JSF messages Tag View All Comments
Post your Comment