Back Forum Reply New

Model data failing to bind

I'm currently using SWF 2.0.5 with Spring MVC 2.5.5 and Hibernate.

I'm trying to convert a string to an object, which I've defined, using a custom converter that delegates responsibility to a property editor. I believe that the data is not binding correctly. When I try to continue (via the submit button calling the quot;continuequot; event id), the view is reloaded and the place is not set on the report.

My conversion service (using 'AT' for the annotation symbol due to spam filter):Code:
'AT'Component(quot;conversionServicequot;)
public class ApplicationConversionService extends DefaultConversionService {   'AT'Resource   private PersistentEntityPropertyEditorltlace, Stringgt; placePropertyEditor;      'AT'Override       protected void addDefaultConverters() {       super.addDefaultConverters();       addConverter(new PropertyEditorConverter(placePropertyEditor, Place.class));   }
}
I've wired in the placePropertyEditor:Code:
lt;bean id=quot;placePropertyEditorquot; class=quotersistentEntityPropertyEditorquot;gt;       lt;constructor-arg ref=quot;placeRepositoryquot; /gt;       lt;constructor-arg value=quot;java.lang.Stringquot; /gt;
lt;/beangt;

lt;bean id=quot;placePropertyEditorBindingquot; class=quotropertyEditorBindingquot;gt;       lt;property name=quot;requiredTypequot; value=quotlacequot; /gt;       lt;property name=quot;propertyEditorquot; ref=quot;placePropertyEditorquot; /gt;
lt;/beangt;
My view-state which is the first state in the flow:Code:
lt;view-state id=quot;newReportquot; model=quot;reportquot; view=quot;/reportFormquot;gt;   lt;bindergt;       lt;binding property=quot;placequot; required=quot;falsequot;/gt;   lt;/bindergt;   lt;on-entrygt;        lt;evaluate expression=quot;placeRepository.getAll()quot; result=quot;flowScope.placesquot;/gt;       lt;evaluate expression=quot;reportService.generateNewReport()quot; result=quot;flowScope.reportquot; /gt;    lt;/on-entrygt;   lt;transition on=quot;continuequot; to=quot;nextStatequot;/gt;   lt;on-exitgt;       lt;!-- persist the report --gt;       lt;evaluate expression=quot;reportService.save(report)quot; result=quot;flowScope.reportquot; /gt;   lt;/on-exitgt;
lt;/view-stategt;
My form that takes the string from a drop down:Code:
lt;form:form id=quot;newReportquot; modelAttribute=quot;reportquot;gt;
lt;ulgt;
lt;ligt;
lt;form:select path=quot;placequot;gt;
lt;formptions items=quot;${places}quot; itemLabel=quot;namequot; itemValue=quot;idquot; /gt;
lt;/form:selectgt;
lt;/ligt;
lt;ligt;
lt;input type=quot;submitquot; id=quot;continuequot; name=quot;_eventId_continuequot; value=quot;Continuequot; /gt;
lt;/ligt;
lt;/ulgt;
lt;/form:formgt;
If I write a custom converter that extends StringToObject and use that, then everything works fine. However, I would like to use property editors since I already have those defined.

Thanks for any input!
¥
Back Forum Reply New