<%--
  Created by IntelliJ IDEA.
  User: 25589
  Date: 2024/12/1
  Time: 下午11:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
    <title>登录</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/login.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
</head>
<body>
    <div class="login-card">
        <h1>登录</h1>
        <form action="${pageContext.request.contextPath}/UserLoginAction" method="POST">
            <label for="username-input">用户名</label><br>
            <input type="text" name="username" id="username-input"><br>
            <label for="password-input">密码</label><br>
            <input type="password" name="password" id="password-input">
            <input type="submit" class="button" value="登录">
        </form>
    </div>
</body>
<script>
    <%
    String loginFlag=request.getParameter("loginflag");
    String username=request.getParameter("username");
    if(loginFlag==null){ //无登录失败标识，是正常访问登录页面
        loginFlag="";
    }
        if(loginFlag.equals("1")){
            out.println("alert('用户【"+username+"】不存在！')");
        }else if(loginFlag.equals("2")){
            out.println("alert('密码错误！')");
        }
    %>
</script>
</html>
