后端登陆

<%@ page import="wangzhan.Thesql" %>
<%@ page import="com.mysql.cj.Session" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
         <title></title>
</head>
<%
    Thesql sql=new Thesql();
    request.setCharacterEncoding("utf-8");
    String id_=request.getParameter("id_");
    String password=request.getParameter("password");
    if(id_!=null)
        if(id_.length()==8){
            if(sql.stu_IsPass(id_, password)){
                HttpSession httpSession= request.getSession();
                httpSession.setAttribute("id_",id_);
                %>
                <jsp:forward page="STU.jsp">
                 <jsp:param value="<%=id_ %>" name="id"/>
                 <jsp:param value="student" name="identity"/> 
                 </jsp:forward>
                <%
            }
        }
        else if(id_.length()==6){
            if(sql.tea_IsPass(id_, password)){
                HttpSession httpSession= request.getSession();
                httpSession.setAttribute("id_",id_);
                %>
                <jsp:forward page="TEA.jsp">
                 <jsp:param value="<%=id_%>" name="id_"/>
                 <jsp:param value="teacher" name="identity"/> 
                 </jsp:forward>
                <%
            }
        }
        else if(id_.length()==3){
            if(sql.root_IsPass(id_, password)){
                HttpSession httpSession= request.getSession();
                httpSession.setAttribute("id_",id_);
                %>
                <jsp:forward page="all_Root.jsp">
                 <jsp:param value="<%=id_ %>" name="id"/>
                 <jsp:param value="root" name="identity"/>
                 </jsp:forward>
                <%
            }
        }

        %><script type="text/javascript">
            alert('请输入正确密码或是账号。');
        </script>
        <meta http-equiv="refresh" content="1;url=Login.jsp" >
        <%
%>
<body>
</body>
</html>

 

posted @ 2023-05-23 00:18  子过杨梅  阅读(9)  评论(0编辑  收藏  举报