| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <html>
- <head>
- <title>学生管理系统 - 登录</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- background-color: #f5f5f5;
- margin: 0;
- padding: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- }
- .login-container {
- background-color: white;
- padding: 40px;
- border-radius: 8px;
- box-shadow: 0 2px 10px rgba(0,0,0,0.1);
- width: 300px;
- }
- .login-container h2 {
- text-align: center;
- color: #333;
- margin-bottom: 30px;
- }
- .form-group {
- margin-bottom: 20px;
- }
- .form-group label {
- display: block;
- margin-bottom: 5px;
- color: #666;
- }
- .form-group input {
- width: 100%;
- padding: 8px;
- border: 1px solid #ddd;
- border-radius: 4px;
- box-sizing: border-box;
- }
- .btn {
- width: 100%;
- padding: 10px;
- background-color: #007bff;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- .btn:hover {
- background-color: #0056b3;
- }
- .error {
- color: red;
- text-align: center;
- margin-bottom: 15px;
- }
- </style>
- </head>
- <body>
- <div class="login-container">
- <h2>学生管理系统</h2>
-
- <% if (request.getParameter("error") != null) { %>
- <div class="error">用户名或密码错误!</div>
- <% } %>
-
- <form action="${pageContext.request.contextPath}/login" method="post">
- <div class="form-group">
- <label for="username">用户名:</label>
- <input type="text" id="username" name="username" required>
- </div>
- <div class="form-group">
- <label for="password">密码:</label>
- <input type="password" id="password" name="password" required>
- </div>
- <button type="submit" class="btn">登录</button>
- </form>
-
- <!-- 简单演示用,实际项目中应该使用数据库验证 -->
- <script>
- // 演示用,实际应该在后端验证
- document.querySelector('form').addEventListener('submit', function(e) {
- const username = document.getElementById('username').value;
- const password = document.getElementById('password').value;
-
- // 简单验证(演示用,实际应该在后端验证)
- if (username === 'admin' && password === 'admin123') {
- // 登录成功
- } else {
- e.preventDefault();
- alert('用户名或密码错误!请使用 admin/admin123');
- }
- });
- </script>
- </div>
- </body>
- </html>
|