<%@ 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>