Hi
I'm using the new Spring form taglib to display a drop-down selection of months. The select tag is displayed correctly but when the form is submitted the <form:errors path="month"/> shows the following error:
Failed to convert property value of type [java.lang.String] to required type [com.leroy.Month] for property month; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
This is how I've coded the jsp:
Code:<b>Month: </b><form:select items="${months}" path="month" itemLabel="name" itemValue="id"/> <form:errors path="month"/>
This is how I've coded the controller:
Any ideas on what I'm doing wrong?Code:protected Map referenceData(HttpServletRequest request) throws Exception { Map<String, Collection<Month>> reference = new HashMap<String, Collection<Month>>(); Collection<Month> months = new ArrayList<Month>(); months.add(new Month(1, "Jan")); months.add(new Month(2, "Feb")); months.add(new Month(3, "Mar")); months.add(new Month(4, "Apr")); months.add(new Month(5, "May")); reference.put("months", months); return reference; }
Thanks


Reply With Quote