zoukankan      html  css  js  c++  java
  • 3.26

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <!DOCTYPE HTML >
    <html>
      <head>
        <title>登录界面</title>
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
        <style type="text/css">
        .contentArea{450px;position:absolute;top:80px;left:250px;height:500px;}
         </style>
      </head>
       
      <body  style="background:url(images/1.jpg)">
      <div class="contentArea">
      <p style="font-family:黑体;font-size:56;color:yellow"></p>
       登录<br/><br/><br/>
       <form action="dologin.jsp" name="myform" method="post" >
        用户名:<input type="text" name="uname"><br/><br/>
        密码:<input type="password" name="upwd"><br/>  <br/>
        验证码:<img src="number.jsp"/>
              <input type="text" name="code"/>
              <br/><br/>
       <input type="submit" value="登录"><br/><br/><br/><br/>
       <a href="register.jsp" >还没账户 进行注册</a>
       </form>
        
       </div>
      </body >
    </html>
    

      

    <%@ page contentType="image/jpeg" language="java" import="java.util.*,java.awt.*,java.awt.image.*,javax.imageio.*" pageEncoding="utf-8"%>
      
    <%
        //获取登录的用户名
        String name = request.getParameter("uname");
        //获取登录密码
        String pwd = request.getParameter("upwd");
        //判断
      
        if (name.equals("zs") && pwd.equals("123"))//判断字符串是否相等不是等号是eqyals
            //转发到ok页面
            request.getRequestDispatcher("ok.jsp").forward(request,response);
        else
            //转发到no页面
            request.getRequestDispatcher("login.jsp").forward(request,response);
    %>
    

      

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
     
     
    <!DOCTYPE HTML>
    <html>
      <head>
     
        <title>注册界面</title>
     
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
        <style type="text/css">
        .contentArea{450px;position:absolute;top:150px;left:250px;height:500px;}
        </style>
      </head>
     
      <body style="background:url(images/1.jpg)" >
      <div class="contentArea">
      注册个人信息:<br/><br/>
       <form action="dologin.jsp" name="myform" method="post" >
       用户名:<input type="text" name="uname"><br/><br/>
       密码:<input type="password" name="upwd"><br/><br/>
     
       性别:男孩<input type="radio" name="sex" checked="checked" value="男">
                   女孩<input type="radio" name="sex" value="女" value="女"><br/><br/>
     
     
     爱好:<br/><br/>
     
       旱冰<input type="checkbox" name="hobby" value="旱冰">
       排球<input type="checkbox" name="hobby" value="排球">
       看书<input type="checkbox" name="hobby" value="看书">
       听音乐<input type="checkbox" name="hobby" value="听音乐">
       追剧<input type="checkbox" name="hobby" value="追剧">
       <br/>
       <br/>
     
     
       <select name="xl">
       <option value="幼儿园">幼儿园</option>
       <option value="小学">小学</option>
       <option value="初中">初中</option>
       <option value="高中">高中</option>
       <option value="本科">本科</option>
       <option value="硕士">硕士</option>
       <option value="博士">博士</option>
       </select>
     
       <br/>
          <br/>
             <br/>
                <br/>
     
       <input type="reset">
       <input type="submit" value="注册">
       </form>
     
       </div>
     
      </body>
    </html>
    

      

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
     
    <%
        request.setCharacterEncoding("utf-8");//防止乱码
        String name = request.getParameter("uname");//获取表单中名为uname的控件的value,返回的类型为字符串,如果要变成数值,需要类型转换
        String pwd = request.getParameter("upwd");//此时的关键值要与之前界面的值相对应
        String sex = request.getParameter("sex");
        String xl = request.getParameter("xl");
     
        String[] hobbys = request.getParameterValues("hobby");//数组的取值,相同value的值为一类
    %>
     
    你注册的姓名是:<%=name%><br/>
    你注册的密码是:<%=pwd%><br/>
    你注册的性别是:<%=sex%><br/>
    你注册的学历是:<%=xl%><br/>
    你的爱好是:
    <%
        for (int i = 0; i < hobbys.length; i++)
            out.print(hobbys[i] + "&nbsp&nbsp&nbsp");
    %>
    

      

    <%@ 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 'index.jsp' starting page</title>
     
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
        <style type="text/css">
        .contentArea{450px;position:absolute;top:150px;left:250px;height:500px;}
        </style>
      </head>
       
      <body  style="background:url(images/1.jpg)">
      <div class="contentArea">
      <h1 style="color: red">登录成功</h1>
       </div>
        
      </body>
    </html>
    

      

    <%@ 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 '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">
        -->
        <style type="text/css">
        .contentArea{450px;position:absolute;top:150px;left:250px;height:500px;}
        </style>
      </head>
       
      <body  style="background:url(images/1.jpg)">
       <div class="contentArea">
      <h1 style="color: red">登录失败</h1>
       </div>
        
      </body>
    </html>
    

      

    <%@ page contentType="image/jpeg" language="java" import="java.util.*,java.awt.*,java.awt.image.*,javax.imageio.*" pageEncoding="utf-8"%>
      
    <%!
        Color getRandColor(int fc,int bc){
            Random random = new Random();
            if(fc > 255){
                fc = 255;
            }
            if(bc < 255){
                bc = 255;
            }
            int r = fc +random.nextInt(bc-fc);
            int g = fc +random.nextInt(bc-fc);
            int b = fc +random.nextInt(bc-fc);
      
      
            return new Color(r,g,b);
        }
    %>
      
    <%
        //设置页面不缓存
        response.setHeader("Pragma","no-cache");
        response.setHeader("Cache-Control","no-catch");
        response.setDateHeader("Expires",0);
      
        //在内存中创建图象
        int width = 60;
        int height = 20;
        BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
      
        //创建图象
        Graphics g = image.getGraphics();
        //生成随机对象
        Random random = new Random();
        //设置背景色
        g.setColor(getRandColor(200,250));
        g.fillRect(0,0,width,height);
        //设置字体
        g.setFont(new Font("Tines Nev Roman",Font.PLAIN,18));
        //随机产生干扰线
        g.setColor(getRandColor(160,200));
        for(int i = 0; i < 255; i++){
            int x = random.nextInt(width);
            int y = random.nextInt(height);
            int xl = random.nextInt(12);
            int yl = random.nextInt(12);
        }
        //随机产生认证码,4位数字
        String sRand = "";
        for(int i = 0; i < 4; i++){
            String rand = String.valueOf(random.nextInt(10));
            sRand  += rand;
            //将认证码显示到图象中
            g.setColor(new Color(20 + random.nextInt(110),20 + random.nextInt(110),20 + random.nextInt(110)));
            g.drawString(rand,13*i+6,16);
        }
        session.setAttribute("rCode",sRand);
        //图像生效
        g.dispose();
        //输出图像到页面
        ImageIO.write(image,"JPEG",response.getOutputStream());
        out.clear();
        out = pageContext.pushBody();
    %>
    

      

  • 相关阅读:
    javascript数据结构与算法---二叉树(查找最小值、最大值、给定值)
    javascript数据结构与算法---检索算法(二分查找法、计算重复次数)
    javascript数据结构与算法---检索算法(顺序查找、最大最小值、自组织查询)
    javascript数据结构与算法--高级排序算法(快速排序法,希尔排序法)
    ThinkPHP5中Session的使用
    能让你少写1000行代码的20个正则表达式
    composer 安装
    thinkphp5.0 实现图片验证效果且能点击图片刷新图片
    thinkphp5.0 实现单文件上传功能
    thinkphp5.0 输入变量
  • 原文地址:https://www.cnblogs.com/xiaomoa/p/14593907.html
Copyright © 2011-2022 走看看