Formatting - Seams / RichFaces / JSF / xhtml


While validation becomes simple with Seam, standard JSF validation messages are not very flexible. Although you can assign CSS classes to customize the look of the error message itself, you cannot alter the appearance of the input field that contains the invalid input. The following formatting tags allow you to decorate invalid fields with styles and messages. In addition to validation message formatting Seam provides
formatting components for applying labels directly to JSF input fields, optionally rendering HTML tags, and optionally rendering page fragments.

Formatting Examples

To use a Seam decorator, you first define how the decorator behaves using special named JSF facets. The beforeInvalidField facet defines what to display in front of the invalid field; the afterInvalidField facet defines
what to display after the invalid field, and the tag shows the error message for the input field; and the aroundInvalidField facet defines a span or div element that encloses the invalid field and the error message. You also can use the aroundField facet to decorate the appearance of valid
(or initial) input fields.
Now you can simply enclose each input field in a pair of
tags as shown below:


Post a Comment

Popular Posts