• P142-1


    P142-1.1 登录页面

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8" isErrorPage="true"%>
        <%@ page import="java.net.URLEncoder" %>
    <!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>
    
    <form name="login" method="post" action="P142-1.3.jsp">
    用户名:
    <input name="uersname" type="text" width="30" />
    <br>
    密码:<input name="password" type="password" width="30" />
    <br>
    <input type="submit" value="登录"/>
    </form>
    </form>
    </body>
    </html>

    P142-1.2 错误提示页面

    <%@ 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>登录信息有误</title>
    </head>
    <body>
    <%
    response.setHeader("refresh","3;P142-1.1.jsp"); %> 您输入的密码有误! <br> <a href="P142-1.1.jsp">3秒后将返回登录页面,或点击此处返回</a> </body> </html>

    P142-1.3 用户信息处理

    <%@ 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>登录信息处理</title>
    </head>
    <body>
    <%
    
    
    
    String un = request.getParameter("usersname");
    
    String pw = request.getParameter("password");
    
    if(un == null || un.trim().length() == 0)
    {
        out.print("请输入正确的用户名");
    }
    else if(pw == null || pw.trim().length() == 0)
    {
        out.print("请输入正确的密码");
    }
    else
    {
        //查找用户信息
        String yonghu = "duke";
        String mima = "zxczxc";
        
        if(un.equals(yonghu))
        {
            if(pw.equals(mima))
            {
                out.print("登录成功");
                response.sendRedirect("P142-2.1.jsp");
            }
            else
            {
                response.sendRedirect("P142-1.2.jsp");
            }
        }
        else
        {
            out.print("该用户不存在,请注册");
        }
    }
    
    %>
    
    </body>
    </html>
  • 相关阅读:
    腾讯微博登录组件
    daffodil
    素数是个什么东西 prime number
    sama5d3 xplained 文件系统配置IP,系统复位后IP丢失[已解决]
    sama5d3 xplained 系统加载后确认使用的网口
    SAMA5D3 Xplained 开发板烧写官方固件后启动失败【已解决】
    linux文件系统解压 tar: Exiting with failure status due to previous errors [Solved]
    安装POSIX man 手册
    老子《道德经》第四十三章
    老子《道德经》第四十二章
  • 原文地址:https://www.cnblogs.com/shadowduke/p/4993361.html
Copyright © 2020-2023  润新知