requestType = request.getHeader("X-Requested-With"); if(requestType==null){//form表单请求 }else{//ajax请求 }