struts登陆的正则验证,正则登陆出错不return的问题

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<html>
<head>
< http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户登陆</title>

< language='java'>
var reg=/^\d{2}$/;
loginValidate(loginUName,loginUPwd)
{
 var loginUName=loginUName.value;
 var loginUPwd =loginUPwd.value;
 if(reg.test(loginUName) && reg.test(loginUPwd))
 {
  alert('恩,很听话!');
 }
 else
 {
  alert("用户名和密码只能是a-z、A-Z、0-9、下划线的字符");
  return false;
 }
}
</>

</head>

<body>
<html:form action="/login.do" method="post"  onsubmit="return loginValidate(loginUName,loginUPwd)">
  <tr>
  
  <td>用户名 :</td><td><html:text property="loginUName" style="ime-mode:disabled" down="if(event.keyCode==13)event.keyCode=9"/></td>
  </tr>
  <tr>
  <td>密  码 :</td><td><html:password property="loginUPwd"  style="ime-mode:disabled;width: 130 px; "/></td>
  </tr>
  <tr>
  <td colspan="2" align="center">
   <html:submit value="登陆"/>
  </td>
    
   </tr>
   <tr>
   
  <td colspan="2" align="center">
  <a href="../public/NewUser.jsp" target="_top">注册</a>
  </td>
  </html:form>
</body>
</html>

 

黑色头发  http://heisetoufa.iteye.com

你可能感兴趣的:(apache,html,bean,jsp,struts)