login_deal.jsp
来自「采用TOMCAT+SQL编程」· JSP 代码 · 共 21 行
JSP
21 行
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage=""%>
<jsp:useBean id="conndb" scope="page" class="beans.connDB"/>
<jsp:useBean id="chstr" scope="page" class="beans.chStr"/>
<%String password="";
String username=chstr.chStr(request.getParameter("username"));
try
{ResultSet rs=conndb.executeQuery("select * from userdata where username='"+username+"' and freeze=0");
if(rs.next())
{password=request.getParameter("password");
if(password.equals(rs.getString("password")))
{session.setAttribute("Username",username);
response.sendRedirect("index.jsp");
}
else
{out.println("<script language='javascript'>alert('您输入的密码错误');window.location.href='index.jsp';</script>");}
}
else
{out.println("<script language='javascript'>alert('您输入的用户名错误或您的帐号被冻结');window.location.href='index.jsp';</script>");}
}catch(Exception e)
{out.println("<script language='javascript'>alert('您的操作有误');window.location.href='index.jsp';</script>");}
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?