Customizing JSF's default messages

As we mentioned earlier, it is possible to customize the style (font, color, text, and so on) of JSF default validation messages. Additionally, it is possible to modify the text of the default JSF validation messages. In the following sections, we will explain how to modify error message formatting and text.

Customizing message styles

Customizing message styles can be done via Cascading Style Sheets (CSS). This can be accomplished using the <h:message> style or the styleClass attributes. The style attribute is used when we want to declare the CSS style inline. The styleClass attribute is used when we want to use a predefined style in a CSS style sheet or inside a <style> tag in our page.

The following markup illustrates ...

Get Java EE 7 with GlassFish 4 Application Server now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.