zoukankan      html  css  js  c++  java
  • JAVA日报

    用户管理系统(登录操作)

    用户输入用户名密码后从数据库查询信息 比对用户名密码后允许登录

    <%@ 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>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    Object message = request.getAttribute("message");
    if(message!=null && !"".equals(message)){
    %>
    <script type="text/javascript">
    alert("<%=request.getAttribute("message")%>");
    </script>
    <%if(message.equals("密码正确")){ %>
    <%
    request.getRequestDispatcher("user.jsp").forward(request,response);}%>
    <%} %>
    <div style="position:absolute;100%;height:100%;background:#7FDBFF;">
    <div style="position:absolute;text-align:center;color:red;100%;height:20%;top:0;font-size:100px;">
    用户登录
    </div>
    <div style="position:absolute;60%;height:40%;top:30%;left:20%;">
    <form action="UserServlet?method=enter" method="post">
    <table>
    <tr>
    <td>role:</td>
    <td><input type="text" name="role" id="role"style="400px;height:30px"><br></td>
    </tr>
    <tr>
    <td>id:</td>
    <td><input type="text" name="UserID" id="UserID"style="400px;height:30px"><br></td>
    </tr>
    <tr>
    <td>密码:</td>
    <td><input type="password" name="Password" id="password"style="400px;height:30px"><br></td>
    </tr>
    <tr>
    <td><button type="submit" onclick="return check()">登录</button></td>
    <td><a href="userZ.jsp">注册</a></td>
    </tr>
    </table>
    </form>
    </div>
    </div>
    <script type="text/javascript">
    function check() //封装一个<body>中做成点击事件的函数
    {
    if(document.getElementById('UserID').value==''||document.getElementById('role').value==''||document.getElementById('Password').value=='') {
    alert('有为空信息!');
    return false;
    }else {return true;}
    }
    </script>
    </body>
    </html>

  • 相关阅读:
    NOIP2014-普及组复赛-第二题-比例简化
    NOIP2014-普及组复赛-第一题-珠心算测验
    洛谷-不高兴的津津(升级版)-数组
    洛谷-陶陶摘苹果(升级版)-数组
    洛谷-小鱼比可爱-数组
    小车问题
    洛谷-小鱼的数字游戏-数组
    洛谷-校门外的树-数组
    centos 6.5 minimal 安装及vm-tools安装
    php使用第三方登录
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14906034.html
Copyright © 2011-2022 走看看