The h:messages tag shows all the error messages at one place corresponding to UI elements. The “for” attribute can be used to represent the field for which error message has to be displayed.