Java for JSP, the code is as follows:
/**go to modify page *@param * @throwsException*/@RequestMapping (Value= "/goedit") PublicModelandview Goedit (model model)throwsexception{Modelandview MV= This. Getmodelandview (); Pagedata PD=NewPagedata (); PD= This. Getpagedata (); //get a tree-shaped listJsonarray arr = jsonarray.fromobject (Goodstypeservice.listallgoodstypenourl ("0"));//The first level ID of the product type is filled here;String JSON =arr.tostring (); JSON= Json.replaceall ("goodstype_id", "ID"). ReplaceAll ("Goodstype_parentid", "PId"). ReplaceAll ("Goodstype_name", "NAME "). ReplaceAll (" Subdict "," nodes "). ReplaceAll (" Hasdict "," checked "). ReplaceAll (" Treeurl "," url "); Model.addattribute ("Ztreenodes", JSON); Mv.addobject ("goodstype_id", 0);//0 represents the root directoryPD= Receivingstandardservice.findbyid (PD);//read by ID//query all items according to the harvest criteriaList<pagedata> wllist =receivingstandardmaterielservice.findwlbyreceivingstandard_id (PD); //Search all plants according to the harvest criteriaList<pagedata> gclist =receivingstandardfactoryservice.findgcbyreceivingstandard_id (PD); Mv.setviewname ("Cgxtpt/receivingstandard/receivingstandard_edit"); Mv.addobject ("MSG", "edit"); Mv.addobject ("Wllist", Jsonarray.fromobject (wllist)); ----focus is here Mv.addobject ("Gclist", Jsonarray.fromobject (gclist)); Mv.addobject ("PD", PD); returnMV; }
Reception JSP Reception:
<input type= "hidden" name= "wllist" id= "wllist" Value= ' ${wllist} ' > <input type= "hidden" name= "Gclist" id= " Gclist "Value= ' ${gclist} ' >
Form forms submitted to Java processing
/**Modify *@param * @throwsException*/@RequestMapping (Value= "/edit") PublicModelandview edit ()throwsexception{Logbefore (Logger, jurisdiction.getusername ()+ "Modify Receivingstandard"); if(! Jurisdiction.buttonjurisdiction (Menuurl, "edit")) {return NULL;}//Verify PermissionsModelandview mv = This. Getmodelandview (); Pagedata PD=NewPagedata (); PD= This. Getpagedata (); Receivingstandardservice.edit (PD); /**Operation Record*/Session Session=jurisdiction.getsession (); User User=(User) Session.getattribute (Const.session_user); Pagedata PD1=NewPagedata (); Pd1.put ("Receivingstandardrecord_id", This. Get32uuid ()); Pd1.put ("Receivingstandard_id", Pd.getstring ("receivingstandard_id")); Pd1.put ("Updaterid", user.getuser_id ()); Pd1.put ("UpdateName", User.getname ()); Pd1.put ("UpdateTime", Dateutil.gettime ()); Receivingstandardrecordservice.save (PD1); /**end of Operation Record*/ //query all items according to the harvest criteriaList<pagedata> wllist =receivingstandardmaterielservice.findwlbyreceivingstandard_id (PD); //Search all plants according to the harvest criteriaList<pagedata> gclist =receivingstandardfactoryservice.findgcbyreceivingstandard_id (PD); //the previous itemlist<jsonobject> oldwllist = Jsonarray.fromobject (Pd.get ("Wllist")) ; ----------The point is here .//before the factorylist<jsonobject> oldgclist = Jsonarray.fromobject (Pd.get ("Gclist")) ; //all previous materials and factories were removedString MSG2 = Orderdataservice.sendwmszjornojson (oldwllist, Oldgclist, "N"); //now the material, the factory all plusString msg = Orderdataservice.sendwmszjorno (wllist, Gclist, "Y"); System.out.println ("Material ..... "+msg+MSG2); Mv.addobject ("MSG", "Success"); Mv.setviewname ("Save_result"); returnMV; }
Two types of data, one is the Pagedata one is the Jsonobject, the latter gets the data is: get ();
list<pagedata> jsp hidden domain, back to Java