• 第六周作业


    <%@ 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></title>
        <style type="text/css">
    body{ font-size:13px; font-family:"宋体";}               
    body,form,input,p{ padding:0; margin:0; border:0;}      
    form{
        300px;
        height:200px;
        padding-top:20px;
        margin:60px auto;                   
        background:#2aa 6ea;              
        border-radius:30px;                 
        border:2px solid #4faccb;
    }
    p{
        margin-top:20px;
        text-align:center;
    }                 
    p span{
        30px;
        display:inline-block;
        text-align:right;
        }               
    .num,.pass{                             
        152px;                                    
        height:18px;                               
        border:1px solid #38a1bf;
        padding:2px 2px 2px 22px;
    }
    .num{                                   
         background:url(images/1.jpg) no-repeat 5px center #FFF;
         color:#999;
    }                   
    .pass{                                                                              
         background:url(images/2.jpag) no-repeat 5px center #FFF;
    }
    .btn01,.btn02{
        60px;
        height:25px;
        border-radius:3px;                     
        border:1px solid #6b5d50;
        margin-left:30px;
        }
    .btn02{ background:#3aa7ea;}                 
    </style>
      </head>
        
      <body>
        <form action="dologin.jsp" method="post" autocomplete="on"> 
        <p>
            <span>账号:</span>
            <input type="text" name="user" class="num"  />
        </p>
        <p>
             <span>密码:</span>
             <input type="password" name="password" class="pass"/>
        </p>
        <p><span>验证码</span><input type="text" name="code"/>qwer</p>
          
        <p>
            <input type="submit" class="btn02" value="登录"/>
       </p>
        
        </form>
             
      </body>
    </html>
    <%@page import="java.sql.ResultSet"%>
    <%@page import="java.sql.PreparedStatement"%>
    <%@page import="java.sql.DriverManager"%>
    <%@page import="java.sql.Connection"%>
    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"
        import=" javax.servlet.http.HttpSession"
        %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%
    request.setCharacterEncoding("UTF-8");
    response.setContentType("text/html;charset=utf-8");
    response.setCharacterEncoding("UTF-8");
     HttpSession s = request.getSession();
     
     String username = request.getParameter("username");
     String password1 = request.getParameter("password");
         Class clazz = Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/school";
        String user = "root";
        String password = "root";
        Connection conn = DriverManager.getConnection(url, user, password);
        PreparedStatement ps = conn.prepareStatement("select uname,upwd from user where uname = ? and upwd = ?");
        ps.setString(1, username);
        ps.setString(2, password1);
        ResultSet rs = ps.executeQuery();
        if(rs.next()){
             session.setAttribute("username", username);
             session.setAttribute("password", password1);
             response.sendRedirect("/school/success.jsp");
        }else{
            response.sendRedirect("/school/loginyanzheng2.jsp");
        }
     
     
      
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
    </head>
    <body>
     
    </body>
    </html>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>title</title>
    </head>
    <body>
     
    <%
        String username = (String) request.getSession().getAttribute("username");
    %>
    欢迎你<%=username%>
    </body>
    </html>
  • 相关阅读:
    PowerShell 批量签入SharePoint Document Library中的文件
    两张图看清SharePoint 2013 Farm 逻辑体系结构
    SharePoint 2013 Step by Step——使用自定义的List Template
    SharePoint 2013 安装 Service Pack 1
    SharePoint 2013 Farm 安装指南——Least Privilege
    SharePoint 2013 Step by Step—— 为终端用户提供故障恢复的解决方案 Part I
    SharePoint 2013 Step by Step——How to Create a Lookup Column to Another Site(Cross Site)
    Fix SharePoint 2013 Site in Read only mode after an interrupted backup
    迁移TFS,批量将文档导入SharePoint 2013 文档库
    Fix Backup Database is terminating abnormally When performing a Farm Backup
  • 原文地址:https://www.cnblogs.com/z118127/p/14649199.html
Copyright © 2020-2023  润新知