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:

http://howtoprogramwithjava.com/session35


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -