使SpringMVC2.5.X支持JSON

@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();
		}
	}

 

你可能感兴趣的:(使SpringMVC2.5.X支持JSON)