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>
    

      

  • 相关阅读:
    每日英语:Easing Gaokao Restrictions: a New Year's Gift?
    每日英语:Targeting Grandpa: China’s Seniors Hunger for Ads
    每日英语:Eight Questions: Bianca Bosker on China's 'Original Copies' in Architecture
    每日英语:There's No Avoiding Google+
    如何删除控制面板中没有"删除"菜单的程序
    html中利用javascript实现文本框字数的动态计算
    一条批处理语句ping局域网内的所有机器
    javascript中的"+"运算
    在asp.net中使用分帧页面时,ajax control报access denied错误的解决方法
    gridview和repeater中取得行的序号
  • 原文地址:https://www.cnblogs.com/zhuxiaolin/p/4999190.html
Copyright © 2011-2022 走看看