Hi @all! My first question as a spring newbie:
How do I show validation errors NEXT to each input/component?
Validator:
@Override
public void validate( final Object obj, final Errors e )
{
ValidationUtils.rejectIfEmpty( e, "firstname", "error.firstname.empty" );
}
JSP:
<form:label path="firstname">
<spring:message code="label.firstname" />
</form:label>
<form:input path="firstname" />
<form:errors path="firstname" /> <!-- THIS DOES NOT WORK! -->
I can show all errors by using the following view code:
<spring:hasBindErrors name="contact">
<ul>
<c:forEach var="error" items="${errors.allErrors}">
<spring:message code="${error.code}"></spring:message>
</c:forEach>
</ul>
</spring:hasBindErrors>
Any ideas?