10.23日进度报告
<%@ 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>
对于登陆界面进行了完善