请问我在用strut2+dwr验证时,能够进行验证,但是比如我在对文本框输入空时就会验证,但是同时在firefox里弹出TypeError: form.elements[fieldName] is undefined对话框,这是怎么回事呢??<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'user_register.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<s:head theme="ajax"/>
</head>
<body>
<s:form id="form1" action="userLogin" method="post" theme="ajax" validate="true">
<s:textfield label="员工编号" name="user_num" id="user_num"></s:textfield>
<br>
<s:password label="密码" name="user_password" id="user_password"/>
<s:submit value="登录"/>
</s:form>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'user_register.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<s:head theme="ajax"/>
</head>
<body>
<s:form id="form1" action="userLogin" method="post" theme="ajax" validate="true">
<s:textfield label="员工编号" name="user_num" id="user_num"></s:textfield>
<br>
<s:password label="密码" name="user_password" id="user_password"/>
<s:submit value="登录"/>
</s:form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货