One, HTML script
<script type= "Text/javascript" >
$ (function () {
$ (". Btn-submit"). Click (function () {
var url = ' ${rc.contextpath}/wxffanapply.htm?method=save ';
var param = $ ("#submitForm"). Serialize ();
$.ajax ({
Url:url,
Type: ' POST ',
DataType: ' JSON ',
Data:param,
Async:false,
Success:function (data) {
if ("data.code" = =) {
Alert ("Save Success");
var url = ' ${rc.contextpath}/wxffanapply.htm?method=pretomain ';
document.getElementById (' SubmitForm '). Action = URL;
document.getElementById (' SubmitForm '). Submit ();
} else {
Alert ("Save exception, please retry");
}
}
});
});
});
</script>
<body>
<div class= "Page-upload" >
<form id= "SubmitForm" action= "" method= "POST" >
<input type= "hidden" name= "Wxopenid" value= "${wxopenid}"/>
<input type= "hidden" name= "Applyid" value= "${applyid}"/>
<input type= "hidden" name= "Wxmoduletype" value= "${wxmoduletype}"/>
<input type= "hidden" name= "Fssid" id= "Fssid"/>
<input type= "hidden" name= "OriginalFilename" id= "OriginalFilename"/>
<input type= "hidden" name= "ImageType" id= "ImageType"/>
<input type= "hidden" name= "Companytype" id= "Companytype"/>
<input type= "button" class= "Btn-upload bg-business-license" name= "Yushow" id= "Yushow" value= "click to upload Business license" onclick= " UPLOADBTN (); " >
<input type= "file" name= "Upload" style= "Display:none" onchange= "previewimg (this);" id= "Upload" accept= "image/*"/ >
<ul class= "Info-list" >
<li class= "Info-list-li" >
<label class= "LABLE-WITH-BG" > Registration number/Credit Code </label>
<div class= "Li-right" >
<input type= "text" class= "input-before-btn" placeholder= "sweep code can be automatically populated" name= "Businessregno" value= "${ orderparam.businessregno!} " />
<button class= "Btn-scan" ></button>
</div>
</li>
<li class= "Info-list-li" >
<label> Company Name </label>
<input type= "text" placeholder= "please fill in the name of the business license" name= "Merchantname" value= "${orderparam.merchantname!}" />
</li>
<li class= "Info-list-li" >
<label> Enterprise Type </label>
<div id= "Trigger1" > Please select </div>
</li>
<li class= "Info-list-li" >
<label> Corporate/Owner name </label>
<input type= "text" placeholder= "please fill in the license on the owner name" name= "Legalname" value= "${orderparam.legalname!}" />
</li>
<li class= "Info-list-li" >
<label> Business Scope </label>
<input type= "text" placeholder= "please fill in the License business scope" Name= "Businessscope" value= "${orderparam.businessscope!" />
</li>
<li class= "Info-list-li" >
<label> Registered Address </label>
<input type= ' text ' id= ' sel_city ' name= "selcity" placeholder= ' Please select '/>
</li>
<li class= "Info-list-li" >
<label> Detailed Address </label>
<input type= "text" placeholder= "Same as business license address" name= "Address" value= "${orderparam.address!}" />
</li>
<li class= "Info-list-li" >
<label> Expiry Dates </label>
<input id= "StartDate" name= "StartDate" class= "select" placeholder= "Please select Start Date"/>
</li>
<li class= "Info-list-li" >
<label> expiry </label>
<input id= "EndDate" name= "endDate" class= "select" placeholder= "Please select Start Date"/>
</li>
<li class= "Info-list-li" >
<label> three-card </label>
<div class= "Li-right" >
<div class= "Slide-block" >
<div class= "Slide-block-ball" ></div>
<input type= "hidden" id= "Isuniformsocialcredit" name= "Isuniformsocialcredit" value= ""/>
</div>
</div>
</li>
</ul>
<div class= "Btn-wrapper" >
<button class= "Btn-submit" > Save </button>
</div>
</form>
</div>
Two, Java code 2.1, code one
public void Save (HttpServletRequest request, httpservletresponse response) {
Logger.info ("Save info Begin ...");
map<string, object> result = new hashmap<string, object> ();
try {
String Wxopenid = Request.getparameter ("Wxopenid");
String Applyid = Request.getparameter ("Applyid");
String Wxmoduletype = Request.getparameter ("Wxmoduletype");
if (Stringutil.isempty (Wxopenid) | | Stringutil.isempty (Applyid)
|| Stringutil.isempty (Wxmoduletype)) {
Result.put ("Code", "001");
Result.put ("desc", "Required parameter is empty");
Super.tojson (result, response);
Return
}
Get all the parameters in the request as Orderparam
String Paramjson = Packageorderparam (request);
}
2.2, code two
Protected String Packageorderparam (HttpServletRequest request)
Throws Exception {
map<string, object> parammap = getparametermap (request);
String selcity = Request.getparameter ("selcity");
if (Stringutil.isnotempty (selcity)) {
String [] arr = Selcity.split ("\\s+");
String Province=null;
String City=null;
String Country=null;
for (int i = 0; i < arr.length; i++) {
switch (i) {
Case 0:
province = Arr[i];
Break
Case 1:
City = Arr[i];
Break
Case 2:
country= Arr[i];
Break
Default
Break
}
}
Parammap.put ("province", province);
Parammap.put ("City", city);
Parammap.put ("Country", country);
}
Return Jsonutils.map2json (PARAMMAP);
}
2.3, Code Three
@SuppressWarnings ("Unchecked")
Public map<string, object> Getparametermap (HttpServletRequest request) {
map<string, object> resultmap = new hashmap<string, object> ();
map<string, string[]> map = Request.getparametermap ();
Set<map.entry<string, string[]>> set = Map.entryset ();
Iterator<map.entry<string, string[]>> it = Set.iterator ();
while (It.hasnext ()) {
map.entry<string, string[]> Entry = (map.entry<string, string[]>) It.next ();
for (String V: (string[]) Entry.getvalue ()) {
Resultmap.put (Entry.getkey (), v);
}
}
return resultmap;
}
Foreground serialization passed the value, the background gets encapsulated into the map, after the conversion to JSON format, and finally in the JSON inside the parameters of a certain value of the partition, and finally in the JSON format data.