用request.getParameter("")函数,获得值为空

来源:百度知道 编辑:UC知道 时间:2024/05/31 02:46:59
login.html中定义为:
<tr>
<td><img src="image/登录.gif" width="56" height="16" style=""> </td>
<td><input type=text name=ID size="15" ></td>
</tr>
<tr> valign="top"></td><td valign="top"></td></tr><tr><td width="56"><img src="image/注册.gif" width="56" height="16"></td>
<td width="113"><input type=password name=password size="15" ></td>

在login。jsp中定义为
String ID1=request.getParameter("ID");
String password1=request.getParameter("password");

用输出语句输出,发现ID1.,password1,值都为空?
怎么回事?
难道是因为我的那个跳转页面部分么是用的超链接,所以ID值没有传递?
ps:按钮是图片,没有用表单中的按钮!
<input type="password" name="password" size="15&quo

我靠。。。不提交表单话当然收不到了,
用按钮可以这样:
你要提交的地址url?ID=你填的ID&password=你填的password
如果是登陆验证,必须使用post提交表单,而不要用以上方法,用AJAX设置POST提交也可

<input type=password name=password size="15" >
你这些地方按标准来说都应该加上双引号的
<input type="password" name="password" size="15" >

恩 你自己也猜对了,你用超链接肯定没有传值!你可以添加个<form>表单就行啊!

你那个login.html中都没有指明这些text中的值将要向哪里传递,你可以在<tr></tr>标签之外加个<form action="login.jsp" name="loginform"></form>
然后那个action属性当然是表明你传递的页面。或者说先用表单form把这些text包起来,像上面一样,然后在按钮那个上面<input type = "button" name= "bt1" onclick=""> 在onclick上面写script。把你那个表单传过去。

你把登入那个按钮的type弄成submit然后加个form标签action=login.jsp就好了