@ResponseBody @RequestMapping(value = "/checkEmailExists", produces = "application/json") public AjaxResponse checkEmailExists(@RequestParam("email") String email) { boolean exists = userBO.checkEmailExists(email); if (exists) { return new AjaxResponseBuilder().notOk().error("Email [" + email + "] already exist").build(); } else { return new AjaxResponseBuilder().ok().build(); } }