文章標題

前臺代碼 請求地址和參數如下,

    $.ajax({
            type:'POST',
            url:'../../applicationControl/deleteApplicationControl',   
            data:{'id':index},
            dataType:'json',
            success:function(data){
                $("#applicationControlList").datagrid('deleteRow',index);
            }
        });

後臺代碼springmvc @RequestParam(“a”) String a接收參數時會,前臺代碼會報404錯誤
但是如果 是用request.getparameter去接收的話,就沒有的問題的。

    @RequestMapping(value="/deleteApplicationControl")
    public void deleteApplicationControl(@RequestParam("a") String a,HttpServletRequest request,HttpServletResponse response){
        User user = null;
        try{
            System.out.println(a);
            user = StringUtil.checkRequest(request);
            String applicationControlId = request.getParameter("id");
            Long applicationId = null;
            if(null != applicationControlId){
                 applicationId = Long.parseLong(applicationControlId);
            }
        }catch(Exception e){
            e.printStackTrace();
            int resultCode = sysLogService.writeLog(SysLogUtil.exceptionLogMap(this, Constant.ERROR_LEVEL, Constant.INFO_DIFFUSION_PUBLISH, Constant.FIND_APPLICATION_CONTROLLER_LIST, e,user.getUserId()));
            StringUtil.exceptionHandle(response,resultCode);
        }
    }
發佈了28 篇原創文章 · 獲贊 1 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章