前台将参数用json打包到后台

   //前台 代码
   var startDate = $('#startDate').val(); var endDate = $('#endDate').val(); var businessCustomerinvoicecode1 = $('input[name="businessCustomerinvoicecode1"]').val(); var aviation_id = '${aviation_id}'; var mainNumber = '${mainNumber}'; var jsdata = { startDate : startDate, endDate : endDate, businessCustomerinvoicecode1 : businessCustomerinvoicecode1, aviation_id : aviation_id, mainNumber : mainNumber, isbd : 2, } var jsd = JSON.stringify(jsdata); // jsd就是打包的参数
//后台取值

String jsd = request.getParameter("jsd");
        try {   

            JSONObject json = JSONObject.fromObject(jsd);
            String aviation_id = json.getString("aviation_id");
            String mainNumber = json.getString("mainNumber");
            String startDate = json.getString("startDate");
            String endDate = json.getString("endDate"); 
            String isbd = json.getString("isbd"); 
            String businessCustomerinvoicecode1 = json.getString("businessCustomerinvoicecode1");

 

上一篇:年月日时分秒计算时间差


下一篇:使用mui DtPicker插件,关于beginDate,endDate限制区间失效