2013-02-14 14 views

risposta

6

Si potrebbe, se si prevede di visualizzare tutti i messaggi di errore contemporaneamente, utilizzando il seguente taglib.

<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %> 

Qualcosa di simile,

<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 code="${error.code}" 
         arguments="${error.arguments}" 
         text="${error.defaultMessage}"/><br/> 
     </c:forEach> 
    </font> 
    </c:if> 
</spring:hasBindErrors> 

Nota che il nome attributo name="someBean" del tag <spring:hasBindErrors/> è l'oggetto di comando vero e proprio che è destinato al form.

Problemi correlati