1,代码如下:
<form name="form1" method="post" action="/myinfo/regist.do?method=myregist">
<table>
<tr><td>用户名:</td><td><input type="text" size=20 name="username" maxlength="8"/><font color="red">*</font></td></tr>
<tr><td>个人密码:</td><td><input type="password" size=21 name="password1" /><font color="red">*</font></td></tr>
<tr><td>请再输入一次:</td><td><input type="password" size=21 name="password2"/><font color="red">*</font></td></tr></table>
<table>
<input type="button" value="提交" onclick="validform()"/>
<input type="reset" value="重填"/>
</table>
</form>2,在ation里我用request.getParameter("username")接收到的值居然为空,
请教各位了!!!
<form name="form1" method="post" action="/myinfo/regist.do?method=myregist">
<table>
<tr><td>用户名:</td><td><input type="text" size=20 name="username" maxlength="8"/><font color="red">*</font></td></tr>
<tr><td>个人密码:</td><td><input type="password" size=21 name="password1" /><font color="red">*</font></td></tr>
<tr><td>请再输入一次:</td><td><input type="password" size=21 name="password2"/><font color="red">*</font></td></tr></table>
<table>
<input type="button" value="提交" onclick="validform()"/>
<input type="reset" value="重填"/>
</table>
</form>2,在ation里我用request.getParameter("username")接收到的值居然为空,
请教各位了!!!
改为
<input type="submit" value="提交" onclick="validform()"/>
写的request.getParameter("username")吗?
以前也试过,能接受到,不知道现在就为什么接受不到呢?
你是在doGet()还是在doPost()里去取的值。
request.getParameter("username")
里的type改为type="submit"
在检查你的提交方法 在doGet()还是在doPost()里去取的值。
<input type="button" value="提交" onclick="validform()"/>
改为
<input type="submit" value="提交" onclick="validform()"/>
要不改,你把submit()写到validform()中也行。