Announcement Announcement Module
Collapse
No announcement yet.
status.errorCodes doesn't match BindException.getAllErrors() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • status.errorCodes doesn't match BindException.getAllErrors()

    In my SimpleFormController I have:

    protected ModelAndView processFormSubmission(HttpServletRequest request,
    HttpServletResponse response, Object o, BindException e)
    throws Exception {

    System.out.println(e.getAllErrors());

    return super.onSubmit(request, response, o, e);
    }

    which returns the following:

    Field error in object 'test' on field 'urls[0].link':
    rejected value [url 1 link];
    codes [longLink.test.urls[0].link, longLink.test.urls.link, longLink.urls[0].link, longLink.urls.link, longLink.link, longLink.java.lang.String, longLink];

    However, iterating through the errorCodes in JSP only displays the "longLink" error code. Am I missing something?

    <spring:bind path="urls[${vs.index}].link">
    <c:if test="${! empty status.errorCode}">
    <c:forEach items="${status.errorCodes}" var="ec">
    EC: <c:out value="${ec}"/> <br />
    </c:forEach>
    <blink><spring:message code="${status.errorCode}" /></blink>
    </c:if>
    <input name="${status.expression}" value="${status.value}" /> <br />
    </spring:bind>

    Thanks!!!
Working...
X