jsp ajax实现无刷新,鼠标离开文本框即验证用户名,操作如下:新建一个输入页面,起名为input.jsp,
jsp ajax实现无刷新_鼠标离开文本框即验证用户名
在新建一个校验页面,起名为check.jsp,代码如下:
用户名不能为空!"); } else if (groupname.length() 20) { out.println("用户名" groupname "不合法!(长度为4到20位,且不能使用?#=等特殊字符)"); } else if ("zhangsan".equals(groupname)) { out.println("" "用户名" groupname "已被占用,请重新输入!"); } else { out.println("您的用户名可用"); } } catch (Exception e) { System.out.println(request.getServletPath() " error : " e.getMessage()); } %>