首页 > 代码库 > jsp传给java属性,java生成json串,方便以后取出来

jsp传给java属性,java生成json串,方便以后取出来

前台代码

$.ajax({ 
        url : ‘<%=basePath%>userorderother/canUpdateCust.do‘, 
        type : ‘POST‘, 
        data: {‘kdcompany‘:kdcompany, ‘kdcardid‘:kdcardid, ‘odid‘:odid},
        async : false,
        success : function(data) { 
            location.reload();  
        }
    });

后台代码

/**修改地址信息
     * @param
     * @throws Exception
     */
    @RequestMapping(value="/canUpdateCust")
    @ResponseBody
    public PageData canUpdateCust() throws Exception{
        PageData pd = new PageData();        
        pd = this.getPageData();
        try {
            PageData custData = new PageData();
            custData.put("ORDERID", pd.get("odid"));
            pd.remove("orderId");
            JSONObject object = JSONObject.fromObject(pd);
            custData.put("CUSTOMERMAILING", object.toString());
            userorderotherService.updateCust(custData);
        } catch (Exception e) {
            pd.put("status", "err");
            pd.put("msg", e.getMessage());
        }
        pd.put("status", "ok");
        return pd;
    }

 

jsp传给java属性,java生成json串,方便以后取出来