首页 > 其他 > 详细

10.23日进度报告

时间:2020-10-23 23:37:46      阅读:29      评论:0      收藏:0      [点我收藏+]
<%@ page language="java" contentType="text/html; charset=utf-8"
	import="java.sql.*" import="javax.servlet.http.HttpSession"%>
	<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.PreparedStatement" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登录验证</title>
</head>
<body>
	<jsp:useBean id="db1" class="bean.Bean" scope="page" />

	<%
		request.setCharacterEncoding("utf-8");
		String jgname = (String) request.getParameter("user");
		System.out.print("登陆验证界面的username:" + jgname);
		String jgpassword = (String) request.getParameter("pwd");
		System.out.print("登陆验证界面的jgpassword:" + jgpassword);
		//先验证是否为形式审核员或者技术审核员,如果都不是再判断是不是普通用户
		if (jgname.equals("xsadmin")&& jgpassword.equals("xsadmin")) {
			session.setAttribute("jgname", jgname);
			response.sendRedirect("xsadminmain.jsp?jgname=" + jgname);
		}
		
		else if (jgname.equals("jsadmin")&& jgpassword.equals("jsadmin")) {
			session.setAttribute("jgname", jgname);
			response.sendRedirect("jsadminmain.jsp?jgname=" + jgname);
		}
		else{
			String sql = "select username,password from user";
			ResultSet rs = db1.executeQuery(sql);
			while (rs.next()) {
				String name=rs.getString(1);
				String password=rs.getString(2);
				if (jgname.equals(name) && jgpassword.equals(password)) {
					session.setAttribute("jgname", jgname);
					response.sendRedirect("main.jsp?jgname=" + jgname);
				}
			}
			out.print("<script language=‘javaScript‘> alert(‘用户名或密码错误,请重新输入‘);</script>");
			response.setHeader("refresh", "0;url=denglu.jsp");
			rs.close();
		}
		db1.close();
	%>
</body>

</html>

  对于登陆界面进行了完善

10.23日进度报告

原文:https://www.cnblogs.com/sunhongbin/p/13866062.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!