Hi to all,
I receive the exception
in the Errors errors object even before my DetailProductValidator starts validating.Failed to convert property value of type [java.lang.String] to required type [beans.Product] for property product; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [beans.Product] for property product: no matching editors or conversion strategy found
I don't understand why Spring does that. I don't have any input field that is mapped directly to the product property/object. I just use the product object's properties in the jsp. For example, I use:
but I never use:HTML Code:<form:options items="${dpBackObj.product.colorMap}"/> <!-- or --> ${dpBackObj.product.priceInDollars}
Can anyone please explain why this happens? And maybe inform me of a simple solution?HTML Code:<form:input path="product"/>
The bean configuration for the controller is:
The backing object for the DetailProductFormController is:HTML Code:<!-- DETAIL PRODUCT FORM CONTROLLER --> <bean id="productDetailFormController" name="/detail.htm /addToCart.htm" class="detailProduct.DetailProductFormController"> <property name="sessionForm" value="true" /> <property name="commandName" value="dpBackObj" /> <property name="commandClass" value="detailProduct.DetailProductBackingObject" /> <property name="validator"> <bean class="detailProduct.DetailProductValidator" /> </property> <property name="formView" value="detail" /> <property name="successView" value="redirect:/viewCart.htm" /> <property name="cartService" ref="cartServiceImpl"/> </bean>
If you need some other info, I will provide. I also use Spring 2.5.5.Code:public class DetailProductBackingObject { private String quantityOverflowError; private Product product; private int quantity; private ShoppingCart shoppingCart; private long sizeId; private long colorId; public DetailProductBackingObject() { this.product = new Product(); this.sizeId = -1; this.colorId = -1; } //getters and setters }
Kind Regards,
Despot


Reply With Quote
