zoukankan      html  css  js  c++  java
  • JSP第四周作业

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

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

     index.jsp

     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
     2 <%
     3     String path = request.getContextPath();
     4     String basePath = request.getScheme() + "://"
     5             + request.getServerName() + ":" + request.getServerPort()
     6             + path + "/";
     7 %>
     8 <%
     9      String str=request.getParameter("zh");
    10      String pwd=request.getParameter("mm");
    11      if(null!=str){
    12          if(str.equals("zs")&&pwd.equals("123")){
    13              pageContext.forward("dl.jsp");
    14          }else{
    15              out.println("您输入的账号或密码有误,请确认后重新输入!");
    16          }
    17      }
    18 %> 
    19 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    20 <html>
    21 <head>
    22 <base href="<%=basePath%>">
    23 
    24 <title>My JSP 'index.jsp' starting page</title>
    25 <meta http-equiv="pragma" content="no-cache">
    26 <meta http-equiv="cache-control" content="no-cache">
    27 <meta http-equiv="expires" content="0">
    28 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    29 <meta http-equiv="description" content="This is my page">
    30 <!--
    31     <link rel="stylesheet" type="text/css" href="styles.css">
    32     -->
    33 </head>
    34 
    35  <body>
    36     <form action="" method="post"><br>
    37     账号:
    38     <input type="text" name="zh"><br>
    39     密码:
    40     <input type="password" name="mm"><br>
    41     验证码:
    42     <input type="text" name="yz">
    43     <img id="yzmtp" src="images/yz.jpg"/>换一张<br>
    44     <input type="submit" value="登录" name="dl">
    45     </form>
    46   </body>
    47 </html>

    dl.jsp

     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
     2 <%
     3 String path = request.getContextPath();
     4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
     5 %>
     6 
     7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     8 <html>
     9   <head>
    10     <base href="<%=basePath%>">
    11     
    12     <title>My JSP 'dl.jsp' starting page</title>
    13     
    14     <meta http-equiv="pragma" content="no-cache">
    15     <meta http-equiv="cache-control" content="no-cache">
    16     <meta http-equiv="expires" content="0">    
    17     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    18     <meta http-equiv="description" content="This is my page">
    19     <!--
    20     <link rel="stylesheet" type="text/css" href="styles.css">
    21     -->
    22 
    23   </head>
    24   
    25   <body>
    26     欢迎登陆 <br>
    27   </body>
    28 </html>

  • 相关阅读:
    [整理III]微软等数据结构+算法面试100题[最新第61-80题]
    横空出世,席卷互联网--评微软等公司数据结构+算法面试100题
    SQL Server2008创建约束图解
    sqlserver2008中如何用右键可视化的设置外键
    SQL的主键和外键约束
    Visual Basic|VB 6.0中文版
    java 用eclipse j2ee写的servlet 程序,WEB-INF下的配置文件web.xml在哪啊?谢谢!
    SQL Server数据的导入导出
    MySQL命令行导出数据库
    VS2010数据库连接问题
  • 原文地址:https://www.cnblogs.com/qq1123514689/p/14583796.html
Copyright © 2011-2022 走看看