boolean isAjax(HttpServletRequest request){
return (request.getHeader("X-Requested-With") != null
&& "XMLHttpRequest".equals(request.getHeader("X-Requested-With").toString())) ;
}
// org.springframework.web.context.request.WebRequest;
public static boolean isAjaxRequest(WebRequest webRequest) {
String requestedWith = webRequest.getHeader("X-Requested-With");
return requestedWith != null ? "XMLHttpRequest".equals(requestedWith) : false;
}
javaweb项目判断一个请求是否Ajax请求
猜你喜欢
转载自blog.csdn.net/huangbaokang/article/details/104059686
今日推荐
周排行