zoukankan      html  css  js  c++  java
  • 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>
    

      对于登陆界面进行了完善

  • 相关阅读:
    Linux下新磁盘挂载
    Centos6.5下Haproxy负载均衡搭建
    Linux下redis搭建与配置
    iptables-nat实现反向代理功能
    iptables防火墙规则的添加、删除、保存
    [Python]-tools
    [Python]-Game
    .[Linux]-部署Nagios监控
    [HTML]-web前端
    [Linux]-部署Zabbix监控
  • 原文地址:https://www.cnblogs.com/sunhongbin/p/13866062.html
Copyright © 2011-2022 走看看