JSP简单的登录错误

来源:百度知道 编辑:UC知道 时间:2024/09/28 17:41:36
已经可以实现数据库的插入,现在想登录,:
代码如下:<body>
<jsp:useBean id="login" scope="session" class="reg.dbconn"/>
<%
String username1=request.getParameter("username");

String password1=request.getParameter("password");
ResultSet rs;
rs=login.executeQuery("select password from user_info where username='"+username1+"'");
String password2=rs.getString("password");
if(password1.equals(password2)){
%>
<jsp:forward page="main.jsp">
<%}%>
但却登录错误:type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /login.jsp(21,0) Expecting "jsp:param" standard action with "name" and "value" attributes
org.apache.jasper.co

org.apache.jasper.JasperException: /login.jsp(21,0) Expecting "jsp:param" standard action with "name" and "value" attributes

怎么jsp里面是username 报错是显示的name 你看看是不是你数据库里面的字段取错了

rs=login.executeQuery("select password from user_info where username='"+username1+"'");

//select password from user_info where name='"+username1+"'" 也许是这样 没看到具体情况 不清楚 去看看数据库的字段

要不试下把select password pw 重命名下