zoukankan      html  css  js  c++  java
  • jsp第四周

    登录功能  用户名zs 密码123 登录成功  

    要求 有验证码功能  界面要美观

     index.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://"
                + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
    %>
    <%
         String str=request.getParameter("zh");
         String pwd=request.getParameter("mm");
         if(null!=str){
             if(str.equals("zs")&&pwd.equals("123")){
                 pageContext.forward("dl.jsp");
             }else{
                 out.println("您输入的账号或密码有误,请确认后重新输入!");
             }
         }
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
    </head>
    
     <body>
        <form action="" method="post"><br>
        账号:
        <input type="text" name="zh"><br>
        密码:
        <input type="password" name="mm"><br>
        验证码:
        <input type="text" name="yz">
        <img id="yzmtp" src="images/yz.jpg"/>换一张<br>
        <input type="submit" value="登录" name="dl">
        </form>
      </body>
    </html>
    

      dl.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
    
        <title>My JSP 'dl.jsp' starting page</title>
    
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
    
      </head>
    
      <body>
        欢迎登陆 <br>
      </body>
    </html>
    

      

     

  • 相关阅读:
    codeforces 505E Mr. Kitayuta vs. Bamboos 题解
    codeforces 568C New Language 题解
    [AGC020E] Encoding Subsets 题解
    技巧瞎扯
    [AGC028C] Min Cost Cycle 题解
    [AGC018D] Tree and Hamilton Path 题解
    codeforces 1217D Coloring Edges 题解
    [AGC003C] BBuBBBlesort! 题解
    [AGC037C] Numbers on a Circle 题解
    [USACO09Open] Tower of Hay 题解
  • 原文地址:https://www.cnblogs.com/overCROSS/p/14590319.html
Copyright © 2011-2022 走看看