前台代码 请求地址和参数如下,
$.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);
}
}