Spring MVC 2.5.XをJSONにサポートする

765 ワード

@RequestMapping("/page/checkUserExistence.do")
	public void checkUserEmailExistence(String strAdminAccounts,
			HttpServletResponse response) {
		response.setContentType("text/javascript;charset=UTF-8");
		response.setHeader("Cache-Control",
				"no-store, max-age=0, no-cache, must-revalidate");
		response.addHeader("Cache-Control", "post-check=0, pre-check=0");
		response.setHeader("Pragma", "no-cache");
		try {
			PrintWriter out = response.getWriter();
			if (userService.findUserEmailExistence(strAdminAccounts)) {
				out.write("true");
			} else {
				out.write("false");
			}
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}