5.22每日总结

发布时间 2023-05-22 22:03:41作者: 漏网鲨鱼
<%@ page language="java" contentType="text/html; charset=UTF-8"

         pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
  <title>登录</title>
  <style type="text/css">
    table {
      /*表格边框为实线或者是空心双线*/
      border-collapse: collapse;
      /*边框与边框的空间*/
      border-spacing: 0;
      padding: 40px ;
    }
    #loginMain {
      width: 400px;
      height:300px;
      margin: 1em auto;
      padding-bottom: 10px;
      border-right: rgb(30,144,255) 2px solid;
      border-top: rgb(30,144,255) 2px solid;
      border-left: rgb(30,144,255) 2px solid;
      border-bottom: rgb(30,144,255) 2px solid;
    }
    input{
      height: 40px;
      width: 240px;
    }

  </style>
</head>
<%
    String pages="";
    pages=request.getParameter("pages");
%>
<%
    String username="";
    String password="";
    out.print(pages);
    //获取cookie里面的值
    Cookie [] cookies = request.getCookies();
    if(cookies!=null){
        //遍历cookie
        for(int i = 0;i<cookies.length;i++){
            if(cookies[i].getName().equals("username")){
                //获取cookie里面的用户名
                username = cookies[i].getValue();
            }else if(cookies[i].getName().equals("password")){
                //获取密码
                password = cookies[i].getValue();
            }
        }
    }
%>
<body background="back.jpg">
<h1 align="center">登 陆</h1>
<br><br>
<form action="check.jsp" method="post">
  <table id="loginMain" border="0" style="font-size:18px;width:480px" align="center">
      <tr>
        <td align="center">用户名:<input type="text" name="username" size="20" placeholder="输入用户名"  style="font-size:18px"/>
      <br><br><input type="hidden" name="pages" value=<%=pages%> />
        密   码:<input type="password" name="password" size="20" placeholder="输入密码" style="font-size:18px"/></td>
      </tr>
      <tr><td align="center" colspan="2"><input type="submit" value="登录" style="width:45px;height:30px;margin:5px 40px"/>
        <input type="reset" value="重置" style="width:45px;height:30px;margin:5px 40px"/>
      </td>
      </tr>
  </table>
</form>
</body>
</html>