On 10/15/07, George.Francis <[EMAIL PROTECTED]> wrote:
>
>
> OK, after reading this I assume I need to define a class
> ApplicationBeanInfo
> which extends SimpleBeanInfo, whose getPropertyDescriptors() method uses a
> class CustomerEditor (which I also have to write) which extends
> PropertyEditor?


Not quite. You only need to write a CustomerEditor (easiest way is by
extending PropertyEditorSupport and overriding the getAsText() and
setAsText() methods) which you register in your controller using the
initBinder() method: http://tinyurl.com/2sutrm

Mike

mraible wrote:
> >
> > You need a PropertyEditor to translate the "id" that's coming for
> > Customer to a real customer object from your database.
> >
> > http://www.springframework.org/docs/reference/validation.html
> >
> > Matt
> >
> > On 10/12/07, George.Francis <[EMAIL PROTECTED]> wrote:
> >>
> >> Hi, I have two entities in my Spring MVC app, 'Application' and
> >> 'Customer'.
> >> The Application edit form has a drop-down list of Customers so that one
> >> can
> >> be associated with the Application.  THis is done via the following
> tags
> >> in
> >> the JSP;
> >>
> >> <form:select path="customer">
> >>                 <form:options items="${customers}" itemValue="id"
> >> itemLabel="name"/>
> >> </form:select>
> >>
> >> When I submit the form I get a validation error:
> >> "Failed to convert property value of type [java.lang.String] to
> required
> >> type [com.ism.ismid.model.Customer] for property customer; nested
> >> exception
> >> is java.lang.IllegalArgumentException: Cannot convert value of type
> >> [java.lang.String] to required type [com.ism.ismid.model.Customer] for
> >> property customer: no matching editors or conversion strategy found"
> >>
> >> Can someone see why this is happening?
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Problemn-associating-entities-via-form-tf4616135s2369.html#a13183354
> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> > --
> > http://raibledesigns.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Problemn-associating-entities-via-form-tf4616135s2369.html#a13214827
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to