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

    control.jsp

    <%@page import="com.gd.dao.stuDao"%>
    <%@page import="com.gd.bean.stu"%>
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
        stu s = new stu();
        int id = Integer.parseInt(request.getParameter("sid"));
        s.setSid(id);
        String uname = request.getParameter("uname");
        s.setUname(uname);
        String upwd = request.getParameter("upwd");
        s.setUpwd(upwd);
        stuDao sd=new stuDao();
        if(sd.addstu(s)>0){
            //跳转注册成功页面 
        }else{
            //错误页面 
        }    
    %>
    <%    
        if(uname.equals("zs")&&upwd.equals("123")){
        //跳转成功登录页面
        request.getRequestDispatcher("welcome.jsp").forward(request, response);
        session.setAttribute("uname",uname);
        }
        else{
        //错误页面
        request.getRequestDispatcher("index.jsp").forward(request, response);
        }
    %>

    index.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>
    <style>
        body{
        600px;
        height:500px;
        overflow: hidden;
        position: relative;
        background-repeat: no-repeat;
        background-image:url(chengshi_yejing-007.jpg);
        }
        
        form{
         300px;
        height: 150px;
        padding-top: 10px;
        margin: 150px auto;                                          
        background: #00000000;                                     
        border-radius: 20px;                                        
        border: 3px solid #f8fcfc;
        opacity: 0.9;}
        table{
         300px;
        height: 80px;
        padding-top: 0px;
        margin: 50px auto; 
        background: #00000000; 
        position:relative;
    
        }
    }
    </style>
      <head>
        
      </head>
      
      <body>
        <form name="form1" method="post" action="control.jsp" >
            <table>
            <tr>    
            <td>编号:</td>
                    <td> <input type="text" name="sid" id="userName"  ></td>
                    </tr>
                <tr>    
                    <td>用户名:</td>
                    <td> <input type="text" name="uname" id="userName"  ></td>
                </tr>
                <tr>    
                     <td>输入登录密码:</td>
                    <td><input type="password" name="upwd" id="pwd"></td>
                </tr>
                
                <tr>    
                    <td colspan="2">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<input type="submit" value="注册">&emsp;<input type="submit" value="登录"></td>
                </tr>
    
                   
            </table>
        </form>
      </body>
    </html>

    welcome.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>
      </head>
      
      <body>
        欢迎登录!
      </body>
    </html>

  • 相关阅读:
    算法笔记_035:寻找最小的k个数(Java)
    (中级篇 NettyNIO编解码开发)第六章-编解码技术
    (入门篇 NettyNIO开发指南)第五章-分隔符和定长解码器使用
    (入门篇 NettyNIO开发指南)第四章-TIP黏包/拆包问题解决之道
    (入门篇 NettyNIO开发指南)第三章-Netty入门应用
    (基础篇 走进javaNIO)第二章-NIO入门
    (基础篇 走进javaNIO)第一章-java的i/o演进之路
    Apache Commons 工具类介绍及简单使用
    SimpleDateFormat使用和线程安全问题
    Calendar使用
  • 原文地址:https://www.cnblogs.com/917174759luowenjing/p/14674097.html
Copyright © 2011-2022 走看看