前台JS
var data={}; data.entername=entername; data.email=email; data.orgcode=orgcode; data.businum=businum; data.taxno=taxno; data.password=password; data.townid=townid; data.regtypeid=regtypeid; data.mobile=mobile; $.ajax({ type: "POST",url: url,data:data,success: function(msg){ var data1=msg.split(","); if(data1[0]=="success" ){ ajaxupload('orgcodefile',data1[1],true); } } });data为传入后台的对象
后台java的解析
Map<String,String[]> map = request.getParameterMap(); Map<String,String> qtMap=new HashMap<String,String>();//存前台参数的Map Set<Entry<String,String[]>> set = map.entrySet(); // Iterator<Entry<String,String[]>> it = set.iterator(); // while (it.hasNext()) { // Entry<String,String[]> entry = it.next(); for (Object i : set.toArray()) { String[] geti=i.toString().split("="); String value=""; if(geti.length==1){ value=""; }else{ value=geti[1]; } String key=geti[0]; qtMap.put(key,value); } // } String XXXX=qtMap.get("XXX");
String XXXX=qtMap.get("XXX");后台取值对应前台对象