jsp登陆页面参数传递的问题

jinancf 2007-03-01 01:05:02
登陆页面login.jsp代码如下:

<html>
<head>
<title>登陆页面</title>
</head>
<body>
<form action="login_conf.jsp" method="post">
用户登陆
用户名:<input type="text" name="uname"> <---参数uname
密码: <input type="password" name="upassword"> <---参数upassword
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
</body>
</html>
****************************************************
验证页面login_conf.jsp代码如下:
<html>
<head>
<title>用户验证页面</title>
</head>
<body>
<h1> 登陆范例-登陆成功 </h1>
<%
String name = request.getParameter(uname); <---出错位置
String password = request.getParameter(upassword);<---出错位置
if ("jncaofeng".equals(name) && "2715065".equals(password)) {
%>
<jsp:forward page="login_success.jsp">
<jsp:param name="name" value="<%=name%>" />
</jsp:forward>
<%
} else {
%>
<jsp:forward page="login_failure.jsp" />
<%
}
%>
<body>
</html>

在Myeclipse中login_conf.jsp显示无法解析uname和upassword,这是怎么回事?
...全文
630 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ylh8306 2007-03-01
  • 打赏
  • 举报
回复
将login_conf.jsp中的 String name = request.getParameter(uname); <---出错位置
String password = request.getParameter(upassword);<---出错位置
改为 String name = request.getParameter("uname");
String password = request.getParameter("upassword");
即可
lily1314 2007-03-01
  • 打赏
  • 举报
回复
呵呵,你的uname和upassword不加引号怎么能行呢
zzxiaoma 2007-03-01
  • 打赏
  • 举报
回复

估计需要加个scrope="request"
killme2008 2007-03-01
  • 打赏
  • 举报
回复
request.getParameter("uname");
request.getParameter("upassword");

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧