您的位置:首页 > 产品设计 > UI/UE

$.ajax请求报400 bad request错误

2016-07-19 23:40 645 查看
页面请求代码:

$.ajax({
url:"check/checkUser.do",
type:"post",
data:{"mobile=":mobile },
dataType:"json",
contentType:"application/json",
success:function(){

},

});
Controller类UserCheckController 代码如下:

@Controller

public classUserCheckController {
@RequestMapping("/check/checkUser.do")
publicModelAndView checkUser(@RequestParam("mobile") Stringmobile){
ModelAndView modelAndView = newModelAndView("/login/login");
System.out.println("1");
return modelAndView;
}

错误原因:是因为类UserCheckController的请求处理方法checkUser的参数错误

@RequestParam("mobile")String mobile,

改为HttpServletRequestrequest,HttpServletResponse response

网上还有很多别的错误类型,我就不列举了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ajax springmvc