jsp网页问题!!!!问下这个代码哪里有错啊。
StringUserID=request.getParameter("UserID");StringPassword=request.getParameter("Pass...
String UserID=request.getParameter("UserID");
String Password=request.getParameter("Password");
DBConnect sys = new DBConnect();
//boolean flag=false;
try{
sys.rs = sys.stmt.executeQuery("select USER_ID,USER_NAME,USER_PWD from T_USER where USER_ID='" + UserID+ "' and USER_PWD='" + Password+ "'");
//int status=0;
boolean flag=false;
if(sys.rs!=null){
if(sys.rs.next()){
if(sys.rs.getString(1).equals(UserID)&&sys.rs.getString(3).equals(Password)){
flag=true;
}
}
}
}catch(Exception e){}
sys.CloseDataBase();
if(flag){
session.setAttribute("UserID", UserID);
out.print("<script>window.location.href='index.jsp';</script>");
}else{
out.print("<script>alert('你的用户名或者密码错误,请重新输入!');window.location.href='login.jsp';</script>");
}
} 展开
String Password=request.getParameter("Password");
DBConnect sys = new DBConnect();
//boolean flag=false;
try{
sys.rs = sys.stmt.executeQuery("select USER_ID,USER_NAME,USER_PWD from T_USER where USER_ID='" + UserID+ "' and USER_PWD='" + Password+ "'");
//int status=0;
boolean flag=false;
if(sys.rs!=null){
if(sys.rs.next()){
if(sys.rs.getString(1).equals(UserID)&&sys.rs.getString(3).equals(Password)){
flag=true;
}
}
}
}catch(Exception e){}
sys.CloseDataBase();
if(flag){
session.setAttribute("UserID", UserID);
out.print("<script>window.location.href='index.jsp';</script>");
}else{
out.print("<script>alert('你的用户名或者密码错误,请重新输入!');window.location.href='login.jsp';</script>");
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询