如果您打算同时显示所有错误消息,则可以使用以下标记库。
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
就像是,
<spring:hasBindErrors htmlEscape="true" name="someBean"> <c:if test="${errors.errorCount gt 0}"> <h4>The error list :</h4> <font color="red"> <c:forEach items="${errors.allErrors}" var="error"> <spring:message pre="${error.pre}" arguments="${error.arguments}" text="${error.defaultMessage}"/><br/> </c:forEach> </font> </c:if> </spring:hasBindErrors>请注意,
name="someBean"标记的name属性
<spring:hasBindErrors/>是绑定到表单的实际命令对象。



