feat: expand struts demo lab

This commit is contained in:
Codex
2026-03-18 18:12:20 +08:00
parent 1f60832445
commit fba7b0497f
25 changed files with 1847 additions and 1447 deletions

View File

@@ -1,58 +1,102 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>用户表单 - Struts2 Demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Form - Struts2 Demo Lab</title>
<style>
body {
font-family: 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
body {
margin: 0;
min-height: 100vh;
padding: 20px;
padding: 24px;
font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
background: linear-gradient(135deg, #f97316 0%, #fb923c 50%, #ffedd5 100%);
}
.container { max-width: 600px; margin: 0 auto; }
.card {
background: white;
padding: 30px;
border-radius: 15px;
box-shadow: 0 15px 50px rgba(0,0,0,0.3);
.shell {
max-width: 820px;
margin: 0 auto;
background: rgba(255,255,255,0.95);
border-radius: 28px;
padding: 28px;
box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}
.eyebrow {
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: #ea580c;
font-weight: 800;
}
h1 { margin: 10px 0 12px; }
p { margin: 0; color: #6c5545; line-height: 1.85; }
.field { margin-top: 16px; }
label { display: block; margin-bottom: 8px; font-weight: 700; color: #4c3422; }
input {
width: 100%;
padding: 13px 14px;
border-radius: 14px;
border: 1px solid #ead8ca;
font: inherit;
}
h2 { color: #f5576c; margin-bottom: 20px; }
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; color: #555; }
input { width: 100%; padding: 12px; border: 2px solid #e0e0e0; border-radius: 8px; }
button {
width: 100%;
margin-top: 18px;
padding: 14px;
background: #f5576c;
border: 0;
border-radius: 14px;
background: linear-gradient(135deg, #ea580c, #fb923c);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 800;
cursor: pointer;
}
.error { color: #c2410c; font-size: 13px; margin-top: 6px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.link-btn {
display: inline-flex;
padding: 10px 14px;
border-radius: 999px;
background: #fff1e8;
color: #c2410c;
text-decoration: none;
font-weight: 700;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<h2>👤 用户信息提交</h2>
<s:form action="submitUser">
<div class="form-group">
<label>用户名</label>
<s:textfield name="username"/>
</div>
<div class="form-group">
<label>邮箱</label>
<s:textfield name="email"/>
</div>
<div class="form-group">
<label>电话</label>
<s:textfield name="phone"/>
</div>
<button type="submit">提交</button>
</s:form>
<div class="shell">
<div class="eyebrow">User action</div>
<h1>Capture a user profile through Struts binding</h1>
<p>This form now demonstrates a more realistic user intake flow with field errors and a structured success screen.</p>
<s:form action="submitUser" method="post" namespace="/">
<div class="field">
<label for="username">Username</label>
<s:textfield id="username" name="username" placeholder="platform-owner"/>
<div class="error"><s:fielderror fieldName="username"/></div>
</div>
<div class="field">
<label for="email">Email</label>
<s:textfield id="email" name="email" placeholder="platform@example.com"/>
<div class="error"><s:fielderror fieldName="email"/></div>
</div>
<div class="field">
<label for="phone">Phone</label>
<s:textfield id="phone" name="phone" placeholder="13800000000"/>
<div class="error"><s:fielderror fieldName="phone"/></div>
</div>
<button type="submit">Submit profile</button>
</s:form>
<div class="links">
<a class="link-btn" href="../index.jsp">Back to portal</a>
<a class="link-btn" href="login.jsp">Open login demo</a>
</div>
</div>
</body>
</html>
</html>