Hi Folks!
I do have a quite strange problem. I try to get my first SpringApplication run and in a Form there's an InputField, where a number should be entered. The JSP looks like this:
To go for sure, I added some kind of "ErrorOverview" at the top of the same Page:Code:<spring:bind path="book.price"> <td valign="top" class="normtext">Preis (€) <c:out value="${status.errorMessage}"/> </td> <td valign="top"> <input class="bigfunc" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"> </td> </spring:bind>
Now, when the form is being submitted, my logger tells me, that there was an Error, because "book.price" can not be mapped from Spring to BigDecimal. This occures whenever the field is left empty, so the mapping from "" to '0' is not possible.Code:<spring:bind path="book.*"> <c:forEach items="${status.errorMessages}" var="errorMessage"> <c:out value="${errorMessage}"/><br> </c:forEach> </spring:bind>
This is the Problem to solve, but the strange thing on this is, that no Error is displayed. When I click 'submit' I get to the same page, like it was just reloaded. The only hint on there was something wrong is the logging:
Thanks in advance for any help,Code:Field error in object 'book' on field 'price': rejectedValue=[]; codes=[typeMismatch.book.price,typeMismatch.price,typeMismatch.java.math.BigDecimal,typeMismatch]; arguments=[(org.springframework.context.support.DefaultMessageSourceResolvable)[codes=[book.price,price]; arguments=[null]; defaultMessage=[price]]]; defaultMessage=[Failed to convert property value of type [java.lang.String] to required type [java.math.BigDecimal] for property 'price'; nested exception is java.lang.NumberFormatException: null];
Karsten


Reply With Quote
- do you have any custom validation or other processing code that might have accidentally dropped the errors from before?
