Files
struts2-demo/web/user/form.jsp
2026-03-18 18:12:20 +08:00

103 lines
3.5 KiB
Plaintext

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Form - Struts2 Demo Lab</title>
<style>
body {
margin: 0;
min-height: 100vh;
padding: 24px;
font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
background: linear-gradient(135deg, #f97316 0%, #fb923c 50%, #ffedd5 100%);
}
.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;
}
button {
width: 100%;
margin-top: 18px;
padding: 14px;
border: 0;
border-radius: 14px;
background: linear-gradient(135deg, #ea580c, #fb923c);
color: white;
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="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>