What Is The Advantage Of Form:label Tag In Spring?
Solution 1:
The <form:label />
tag has access to the underlying model and binding results and as such can, on error, use another style class.
<form:label cssClass="title" cssErrorClass="title error" path="company" />
The code above would, in case of an error, render differently than the normal case. Of course you could also do this without the form tag but that would mean you need to include some logic into your pages, which in general isn't advised.
For all the properties see the reference guide
Solution 2:
I really like using form:xxxx instead of the more traditional tags.
However, it seems to work best with PUT requests where I am modifying something, and maybe DELETE. With POST where everything is new, I tend to end up using the traditional tags.
It does link the human readable to the value being sent for automated readers, but both can do that.
Solution 3:
Not sure. However, it might help for Localization if the "Enter Company name:" was read from a message bundle source. Will check for more resources in the meantime
Post a Comment for "What Is The Advantage Of Form:label Tag In Spring?"