chklogon.jsp

来自「JSP+Struts实现的用户登录系统 数据库:mysql数据库; 技术平台」· JSP 代码 · 共 42 行

JSP
42
字号
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ page import="cn.com.zzb.eshopping.model.*"%>
<%@ page import="cn.com.zzb.eshopping.model.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 
<META HTTP-EQUIV="Expires" CONTENT="0"> 	
<title>用户身份验证</title>
</head>
<%
String ID = request.getParameter("ID");
String password = request.getParameter("password");
String chkcode = request.getParameter("chkcode");
String rand = (String)session.getAttribute("rand");
out.println(chkcode);
out.println(rand);
if(chkcode.equals(rand)){
    UserFactory userFactory = Factory.getInstance().InitUserFactory();
		String info = userFactory.ChkUser(ID,password);	
    out.println(info);
    if(info.equals("0")){
		   response.sendRedirect("logon.jsp?info=0");
		}
		else if(info.equals("1")){
		   response.sendRedirect("logon.jsp?info=1");
		}
		else if(info.equals("2")){
		   response.sendRedirect("logon.jsp?info=2");
		}
		else{
			 response.sendRedirect("../index.jsp");
			 session.setAttribute("user",ID);
    }
}
else{
    response.sendRedirect("logon.jsp?info=3");
}
%>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?