Spring MVC Label Tag Example –
Spring MVC label tag is used to display labels on form.
Syntax
1 | <form:label path="FIELD_NAME_GIVEN">LABEL_TO_BE_DISPLAYED</form:label> |
This gets translated into HTML as
1 | <label for="FIELD_NAME_GIVEN">LABEL_TO_BE_DISPLAYED</label> |
Example:
1 2 3 4 5 | <form:label path="firstName">First Name :</form:label> // gets converted to <label for="firstName">First Name :</label> |
Path attribute in the label tag is useful when displaying errors for that particular field by using the additional cssErrorClass attribute.
More Reference can be found here Label Tag