JSP页面通过Ajax异步验证input输入框的数据

JSP页面信息




   主持人: *
 
							

Struts配置Action信息:

ifUserByName" method="ifUserByName" class="SubjectAction"> 

Action对应的方法:

	public String ifUserByName() throws IOException{
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("UTF-8");
		UsrUser user = userservice.getUserByName(name);
		if(user== null){
			PrintWriter out = response.getWriter();
			out.write("主持人"+name+"不存在");
			out.flush();
			out.close();
		}	
		return null;
	}

JSP页面效果:


 

你可能感兴趣的:(FAQ)