In some web page layouts the errors usually gets displayed at the top of the page rather than near the corresponding fields. This helps in preserving the layout of the web page more easily.
The errors identified by the Spring Validator Framework and controllers can be displayed easily on the web page by using the following code snippet.
<div id="globalError">
<spring:hasBindErrors name="user">
<c:forEach var="error" items="${errors.allErrors}">
<li><spring:message code="${error.code}"
text="${error.defaultMessage}" /></li>
</c:forEach>
</spring:hasBindErrors>
</div>
The above code snippet iterates through the errors identified in the object named "user" and displays them to the user.
Please refer to Handling errors individually to find out on how to configure the errors individually across each field.
Please refer to Handling errors individually to find out on how to configure the errors individually across each field.
No comments:
Post a Comment