Spring MVC Error Messages
Hello, Spring Fellows,
I have a form that is validated by the Spring Validation once submitted. Each field on the form may contain mult
The simplest answer is to not use tables for page layout. Utilizing div tags alleviates this problem altogether since divs are completely dimensionless if set to hidden.
You can do something like this (notice that bind
is from spring taglib):
<spring:bind path = "name*">
<c:if test="${status.error}">
<tr>
<td>
<form:errors path="name*" />
</td>
</tr>
</c:if>
</spring:bind>
I solved your problem by doing this:
<table>
<form:errors path="firstName">
<tr>
<td colspan="2">
<form:errors path="firstName"/>
</td>
</tr>
</form:errors>
<tr>
<td><form:label path="firstName"><spring:message code="helloworld.label.firstName"/></form:label></td>
<td><form:input path="firstName"/></td>
</tr>
</table>
errors tag body will be evaluated only if there are errors on the path.