public boolean isAjaxRequest(HttpServletRequest request){ String header = request.getHeader("X-Requested-With"); boolean isAjax = "XMLHttpRequest".equals(header) ? true:false; return isAjax; }