1222carnivore  

今日写前端网页代码由于把"<%@ page contentType="text/html;charset=UTF-8" language="java" %>"这行语言注释不小心删了导致页面都变成了小怪物

填后页面恢复正常(人家的网页比我的好看多了

后续根据此代码,重新写了一个注册的前端页面
学会了页面跳转方法
<a href="register.jsp">注册</a> 中指网站地址,直接能跳转前面带着项目名的正确地址。
编写注册网页(整体就改几个字)
全部代码:

![](https://img2024.cnblogs.com/blog/3473695/202502/3473695-20250214224733459-642555839.png)
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录页面</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f4f4f9;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
    }
    .login-container {
      background-color: #fff;
      padding: 2rem;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      width: 300px;
    }
    .login-container h2 {
      margin-bottom: 1rem;
      text-align: center;
    }
    .form-group {
      margin-bottom: 1rem;
    }
    .form-group label {
      display: block;
      margin-bottom: 0.5rem;
    }
    .form-group input {
      width: 100%;
      padding: 0.5rem;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    .form-group button {
      width: 100%;
      padding: 0.7rem;
      background-color: #007bff;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      font-size: 1rem;
    }
    .form-group button:hover {
      background-color: #0056b3;
    }
  </style>
</head>
<body>

<div class="login-container">
  <h2>注册</h2>
  <form action="/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>
    <div class="form-group">
      <button type="submit">确认注册</button>
    </div>
  </form>
</div>
posted on 2025-02-14 22:48  作业-----  阅读(12)  评论(0)    收藏  举报