可用登陆代码·

复制代码
<%@ 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 @   子过杨梅  阅读(7)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
· 零经验选手,Compose 一天开发一款小游戏!
点击右上角即可分享
微信分享提示