4.25每日总结

发布时间 2023-04-25 20:31:16作者: 漏网鲨鱼
<%@ 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>歌曲界面</title>
<style>
        a{
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
            font-size: 40px;
            color: #1068f5;
            text-decoration: none;
        }
    </style>
</head>
<body style="background:url(images/bg.jpg) no-repeat;">
<%
String username=null;
String password="";
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();
         }
     }
 }
%>
<a href="#">当前身份:<%
if(username==null)
{
    out.print("未登录");
}else
{
    out.print(username);
}
%></a>
    <div style="margin-top: 300px; margin-left: 700px;">
    <%
    if(username!=null)
    {
        %><a href="first.jsp?pages=1">兰亭序</a><br><br><br><br>
        <a href="second.jsp?pages=2">稻香</a><br><br><br><br>
        <a href="third.jsp?pages=3">反方向的钟</a><br><br><br><br><%
    }
    else
    {
        %>
        <a href="Login.jsp?pages=1">兰亭序</a><br><br><br><br>
        <a href="Login.jsp?pages=2">稻香</a><br><br><br><br>
        <a href="Login.jsp?pages=3">反方向的钟</a><br><br><br><br>
        <%
    }
    %>
    </div>
</body>
</html>