177 lines
5.7 KiB
Plaintext
177 lines
5.7 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>Login Demo - Struts2 Demo Lab</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 24px;
|
|
font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
|
|
background: linear-gradient(135deg, #122c63 0%, #1464c7 52%, #4db5ff 100%);
|
|
}
|
|
.shell {
|
|
width: min(1040px, 100%);
|
|
display: grid;
|
|
grid-template-columns: 1fr 420px;
|
|
gap: 18px;
|
|
}
|
|
.panel {
|
|
background: rgba(255,255,255,0.95);
|
|
border-radius: 28px;
|
|
padding: 28px;
|
|
box-shadow: 0 24px 60px rgba(0,0,0,0.22);
|
|
}
|
|
.eyebrow {
|
|
font-size: 12px;
|
|
letter-spacing: 0.12em;
|
|
text-transform: uppercase;
|
|
color: #1464c7;
|
|
font-weight: 800;
|
|
}
|
|
h1, h2 { margin: 10px 0 12px; }
|
|
p { margin: 0; color: #566a80; line-height: 1.85; }
|
|
.note {
|
|
margin-top: 18px;
|
|
padding: 16px;
|
|
border-radius: 18px;
|
|
background: #edf5ff;
|
|
border: 1px solid #d7e5f7;
|
|
}
|
|
.stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 12px;
|
|
margin-top: 18px;
|
|
}
|
|
.stat {
|
|
padding: 14px;
|
|
border-radius: 18px;
|
|
border: 1px solid #d7e5f7;
|
|
background: #f8fbff;
|
|
}
|
|
.stat strong { display: block; margin-bottom: 6px; }
|
|
.field {
|
|
margin-bottom: 16px;
|
|
}
|
|
label {
|
|
display: block;
|
|
margin-bottom: 8px;
|
|
font-weight: 700;
|
|
color: #1f3650;
|
|
}
|
|
input {
|
|
width: 100%;
|
|
padding: 13px 14px;
|
|
border-radius: 14px;
|
|
border: 1px solid #d6e1ed;
|
|
font: inherit;
|
|
}
|
|
button {
|
|
width: 100%;
|
|
padding: 14px;
|
|
border: 0;
|
|
border-radius: 14px;
|
|
background: linear-gradient(135deg, #1464c7, #3d8ef6);
|
|
color: white;
|
|
font-size: 16px;
|
|
font-weight: 800;
|
|
cursor: pointer;
|
|
}
|
|
.error {
|
|
color: #c53d3d;
|
|
font-size: 13px;
|
|
margin-top: 6px;
|
|
}
|
|
.action-error {
|
|
margin: 0 0 16px;
|
|
padding: 14px;
|
|
border-radius: 14px;
|
|
background: #fff1f1;
|
|
color: #b63a3a;
|
|
border: 1px solid #f1c4c4;
|
|
}
|
|
.links {
|
|
display: flex;
|
|
gap: 10px;
|
|
flex-wrap: wrap;
|
|
margin-top: 18px;
|
|
}
|
|
.link-btn {
|
|
display: inline-flex;
|
|
padding: 10px 14px;
|
|
border-radius: 999px;
|
|
background: #edf5ff;
|
|
color: #1464c7;
|
|
text-decoration: none;
|
|
font-weight: 700;
|
|
}
|
|
@media (max-width: 860px) {
|
|
.shell { grid-template-columns: 1fr; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="shell">
|
|
<section class="panel">
|
|
<div class="eyebrow">Demo login</div>
|
|
<h1>Login flow with validation and guided next steps</h1>
|
|
<p>This page turns the original login example into a better teaching demo. It keeps validation close to the form, shows a reusable credentials note, and links to follow-up demos after success.</p>
|
|
|
|
<div class="note">
|
|
<strong>Demo credentials</strong>
|
|
<p style="margin-top: 8px;">Username: <code>admin</code><br/>Password: <code>123456</code></p>
|
|
</div>
|
|
|
|
<div class="stats">
|
|
<div class="stat">
|
|
<strong>What this demonstrates</strong>
|
|
<span>Action execution, field validation, action errors, and result routing.</span>
|
|
</div>
|
|
<div class="stat">
|
|
<strong>Suggested next route</strong>
|
|
<span>After login, continue with the user form or validation demo.</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="links">
|
|
<a class="link-btn" href="../index.jsp">Back to portal</a>
|
|
<a class="link-btn" href="../hello?name=Team">Run hello action</a>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="panel">
|
|
<div class="eyebrow">Sign in</div>
|
|
<h2>Enter the demo account</h2>
|
|
|
|
<s:if test="hasActionErrors()">
|
|
<div class="action-error"><s:actionerror/></div>
|
|
</s:if>
|
|
|
|
<s:form action="login" method="post" namespace="/">
|
|
<div class="field">
|
|
<label for="username">Username</label>
|
|
<s:textfield id="username" name="username" placeholder="admin"/>
|
|
<div class="error"><s:fielderror fieldName="username"/></div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label for="password">Password</label>
|
|
<s:password id="password" name="password" placeholder="123456" showPassword="true"/>
|
|
<div class="error"><s:fielderror fieldName="password"/></div>
|
|
</div>
|
|
|
|
<button type="submit">Continue to the dashboard</button>
|
|
</s:form>
|
|
</section>
|
|
</div>
|
|
</body>
|
|
</html>
|