Login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<% //写在head中 是为了让页面加载前判断是否进行自动登录 如果不是 再加载页面
Cookie[] cookie=request.getCookies();//获取浏览器中的cookie数组
if(cookie!=null){ //如果不为空 进行遍历
for(Cookie c:cookie){ //找到name为auto的 获取其中的值
String name=c.getName();
String value=c.getValue();
if("auto".equals(name)){//找到auto 获取值
if(value!=null&&!"".equals(value)){//如果有值 将该值请求发给Servlet处理自动登录
response.sendRedirect(request.getContextPath()+"/loginServlet?flag=auto");
}
}
}
}
%>
<style>
*{padding: 0px;margin: 0px}
image{border: none}
#head{
width: 530px;
height: 370px;
background: #2c262a;
position: relative;
border: 0px;
border-radius: 5px;
margin: auto;
}
#top{
width: 530px;
height: 120px;
position: relative;
border: 0px;
}
#center{
width: 530px;
height: 150px;
position: relative;
border: 0px;
}
#bottom{
width: 530px;
height: 100px;
position: relative;
border: 0px;
}
.a{
font-size: 28px;
color: white;
margin-left: 70px;
position: relative;
top: 45px;
}
.b{
color: #207e6a;
font-size: 16px;
margin-left: 70px;
position: relative;
top: 45px;
}
#center input{
width: 270px;
height: 55px;
background-color: #847780;
border: none;
border-radius: 5px;
position: relative;
left: 50px;
margin-top:20px ;
font-size: 18px;
color: #f4fffb;
}
#center button{
width: 79px;
height: 133px;
background: url("img/abc.jpg") no-repeat;
float: right;
position: relative;
border: 0px;
border-radius: 10px;
bottom:55px;
right: 30px;
}
#username{
background-image: url("img/b.jpg");
background-repeat: no-repeat;
background-position: 5px 10px;
text-indent: 2em;
}
#password{
background-image: url("img/c.jpg");
background-repeat: no-repeat;
background-position: 5px 10px;
text-indent: 2em;
}

    #clear{
        clear: both;
    }
    .c{
        margin-top: 40px;
        margin-left: 50px;
    }

    .d{
        width: 80px;
        height: 37px;
        background: #847780;
        border-radius: 5px;
        border: 0px;
        margin-left: 10px;
    }
    .f{
        color: white;
        font-size: 17px;
    }
    .g{
        color: white;
        font-size: 22px;
        margin-left: 10px;
    }
    .e{
        width: 75px;
        height: 49px;
        border: 0px;
        border-radius: 5px;
        position: relative;
        right: -85px;
        top: 15px;
    }
    .b a{
        color: #207e6a;
        text-decoration: none;
    }
    .b a:hover{
        text-decoration: none;
        color: orange;
        font-size: large;
    }
    #ee{
        margin-left: 4em;
        color:red;
    }
    #button{
        width: 75px;
        height: 49px;
       }
</style>

<script type="text/javascript">
    window.onload=function(){
        document.getElementById("button").src="validateCodeServlet?date="+new Date();
        document.getElementById("button").onclick=function(){
            document.getElementById("button").src="validateCodeServlet?date="+new Date();
        }
    }
</script>

</head>
<body>
<div id="head">
<div id="top">
<span class="a">Login</span>
<span class="b"><a href="http://127.0.0.1:8092/WebNew2/User.jsp">Register</a></span>
<span class="b"><a href="http://127.0.0.1:8092/WebNew2/forget.jsp">Forget</a></span>
</div>
<form action="loginServlet" method="post">
<div id="center">
<input id="username" type="text" placeholder="Username" name="username">
<input id="password" type="password" placeholder="Password" name="password">
<span id="ee">
<%String error=(String)request.getAttribute("error");
if(error!=null){%>
<%=error %>
<%} %>
</span>
<button type="submit" ></button>

        <div id="clear"></div>
    </div>
    <div id="bottom">
        <input class="c" type="checkbox" name="autologin" value="1"> <span class="f">Remember</span>
        <input class="d" type="text"><span class="g">点击更换</span>
        <button class="e"  type="button">
            <img src="img/d.jpg" id="button" alt="">
        </button>
    </div>
</form>

</div>
</body>
</html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 各种纯css图标 CSS3可以实现很多漂亮的图形,我收集了32种图形,在下面列出。直接用CSS3画出这些图形,要比...
    剑残阅读 9,715评论 0 8
  • 深入理解傅里叶变换Mar 12, 2017 这原本是我在知乎上对傅立叶变换、拉普拉斯变换、Z变换的联系?为什么要进...
    价值趋势技术派阅读 5,825评论 2 2
  • 1、垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,...
    kiddings阅读 3,213评论 0 11
  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 27,820评论 1 45
  • 你活得不快乐的原因是:既无法忍受目前的状态,又没能力改变这一切,可以像只猪一样懒,却无法像只猪一样懒得心安理得。 ​ ​
    一禅_578b阅读 204评论 0 0