java - SpringMVC initbinder - binding list items form Integer -
i have page has list of custom items register custom editor in init binder of controller allow data binding. list passed form view. problem having on view bind different object.however both objects have attribute in common crimerecno.
i have created binder function under when data passed view controller custom object list create binder receives integer , returns list. under example of have far, isnt binding:
i need know how register custom editor accepts integer crimerecno , returns list , bind list.
binder function
this not binding
crimerecnobindervictimlist.registercustomeditor(integer.class, "crimerecno", new customcollectioneditor(list.class){ protected object convertelement(object element) { list<citizens> victimlist = new arraylist<citizens>(); string crimerecno = null if (element instanceof string) { crimerecno = (string) element; } logger.info("inside crimerecno binder crimerecnobindervictimlist " + crimerecno); try { victimlist = citizenmanager.getlistofvictimsbycrimerecno(integer.parseint(crimerecno)); } catch (exception e) { logger.error("error in crimerecnobindervictimlist "+e.getmessage()); } return victimlist; } });
error
102348 [http-bio-8084-exec-10] debug org.springframework.beans.typeconverterdelegate - converting string [int] using property editor [com.crimetrack.web.crimecontroller$2@4b9e3acd] 102348 [http-bio-8084-exec-10] info com.crimetrack.web.crimecontroller - inside crimerecno binder crimerecnobindercriminallist null 102348 [http-bio-8084-exec-10] error com.crimetrack.web.crimecontroller - null 102358 [http-bio-8084-exec-10] info com.crimetrack.web.crimecontroller - inside crimerecno binder crimerecnobindercriminallist 6
good question,
i'm not sure, tutorial on spring's @initbinder
may help:
Comments
Post a Comment