我第一次请求注册,提交用户名,密码,邮箱;
第二次请求注册,把<input type="text" id="email" name="user.email" />(邮箱)去掉,邮箱属性想提交一个null过去;
结果发现根本不是null,而是第一次请求的提交的邮箱;
然后调试,发现只有第一次提交的时候User类的无参构造被执行了,第二次没有执行无参构造;
即使我第一次请求用IE,第二次用firefox。
我的action有user成员变量和对应的getter和setter
。我的目的就是想第二次的邮箱传个null回去,而不是前一次的内容;
谢谢
这是我的regist.jsp页面:<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'regist.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">
-->

function goSubmit(){
document.regist.submit();
}
</script>
</head>
<body>
<center><strong>注册>>></strong></center>
<center>
<form action="userAction.action?method=regist" name="regist" method="post">
<table border="1">
<tr>
<td>
用户名:
</td>
<td>
<input type="text" id="username" name="user.username" />
</td>
<td id="usernameTemp"></td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="password" id="password" name="user.password" />
</td>
<td id="passwordTemp"></td>
</tr>
<tr>
<td>
请再次输入密码:
</td>
<td>
<input type="password" id="confirmPWD" />
</td>
<td id="confirmPWDTemp"></td>
</tr>
<tr>
<td>
邮箱:
</td>
<td>
<input type="text" id="email" name="user.email" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" id="confirm" onclick="goSubmit();" value="确定" />
<input type="reset" value="重置" />
<input type="button" onclick="history.back(-1);" value="返回" />
</td>
</tr>
</table>
</form>
</center>
</body>
</html>谢谢~