zoukankan      html  css  js  c++  java
  • 151126

    <%@ 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>
    <form action ="yanzheng.jsp" method="post">
    用户:<input type="text" name="userid" width=30/>
    密码:<input type="password" name="password" width=30/>
    <input type="submit" value="登录" />
    </form>
    
    
    </body>
    </html>
    

      

    <%@ 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 strUserid =request.getParameter("userid");
    String strPW =request.getParameter("password");
    if(strUserid == null || strUserid.trim().length() == 0)
    {
    	response.sendRedirect("message.jsp?msgid=1");
    }
    else if(strPW == null || strPW.trim().length() == 0)
    {
    	response.sendRedirect("message.jsp?msgid=2");
    }
    else
    {//查找用户信息
    	String strUID ="zhangsan";
        String strP ="123";
        
        if(strUserid.equals(strUID))
        {
        	if(strPW.equals(strP))
        	{
        		out.print("欢迎登陆");
        		//跳转到系统页面
        	}
        	else
        	{
        		response.sendRedirect("message.jsp?msgid=3");
        	}
        	
        }
        else
        {
        	response.sendRedirect("message.jsp?msgid=4");
        }
    }
    %>
    </body>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
        <%@page import="java.util.*" %>
    <!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 strMsgId =request.getParameter("msgid");
    if(strMsgId == null || strMsgId.trim().length()==0)
    {
    	out.print("信息错误");
    }
    else
    {
    	int iMsgid = Integer.parseInt(strMsgId);
    	switch (iMsgid)
    	{
    	case 1:
    		out.print("账号输入错误");
    	break;
    	case 2:
    		out.print("密码输入错误");
    	break;
    	case 3:
    		out.print("密码错误");
    	break;
    	case 4:
    		out.print("用户不存在");
    	break;
    	default:
    		out.print("无法识别信息");
    		break;
    	}
    }
    response.setHeader("refresh","5;URL=Login.jsp");
    
    %>
    </body>
    </html>
    

      

  • 相关阅读:
    [stm32] Systick
    [stm32] GPIO及最小框架
    51单片机-PC数据传输 温度 距离 监控系统设计
    [游戏学习29] Win32 图像处理1
    [51单片机] 串口通讯 简单通信
    [汇编] 闰年计算
    Java常用工具类之ArrayUtil
    常用工具类系列之DateUtil
    SpringBoot 获取当前登录用户IP
    Spring data jpa Specification查询关于日期的范围搜索
  • 原文地址:https://www.cnblogs.com/zhuxiaolin/p/4999190.html
Copyright © 2011-2022 走看看