开发者

Spring MVC Data binding error

When submitting a form I get the message:

com.xxx.mvc.reports.ReportController: Data binding errors: 6 {||||||| - |}

The command class inherits from an abstract base class.

When using debugging I can see that the values are set on the command class. I use spring 2.5. Somehwere after the fields are set and between the calling of onSubmit in the controller the error occurs. I use a SimpelFormC开发者_如何学JAVAontroller. The onSubmit method isn't called so I can't inspect the BindException there.

What does this mean and how can I troubleshoot this?


I barely posted the question and I found the answer:

<form:errors path="pathName"/>

gives me the errors.


If you want to easily see every binding error related to your command bean in the page, put something like:

<spring:bind path="command.*">
    <c:forEach items="${status.errorMessages}" var="error">
        <font color="red">Error code: <c:out value="${error}"/></font>
        <br><br>
    </c:forEach>
</spring:bind>

The code is for a bean named "command", as default.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜