/**
*@Method 检验用户名是否存在
*/
public String check_yp(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception{
Ddc_YpForm yf = (Ddc_YpForm)form;
String user = request.getParameter("user");
String result = "msgFalse";
try{
if(ydao.checkYp(user)==true){
result = "false";
}else{
result = "true";
}
}catch(Exception ex){
ex.getStackTrace();
ex.printStackTrace();
}
response.setContentType("text/xml;charset=GB2312");
response.setHeader("Cache-Control","no-cache");
response.getWriter().print(result);
response.getWriter().close();
return result;
}
/**
*XG yanzhengma
* At time:2007-9-25
*/
public void check_img(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception{
Ddc_YpForm yf = (Ddc_YpForm)form;
HttpSession session = request.getSession(true);
String result = "msgFalse";
//验证码验证
String image=(String)session.getAttribute("VerifyCode");
String img=request.getParameter("img");
try{
if(image.equals(img)){
result = "false";
}else{
result = "true";
}
}catch(Exception ex){
ex.getStackTrace();
ex.printStackTrace();
}
response.getWriter().write(result);
}
Ajax java 实现用户名自动验证 (3)
最新推荐文章于 2024-09-13 17:30:19 发布