Files
struts2-demo/web/hello.jsp

125 lines
4.2 KiB
Plaintext
Raw Normal View History

2026-03-18 15:18:30 +08:00
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html lang="zh-CN">
2026-03-18 15:18:30 +08:00
<head>
2026-03-18 18:12:20 +08:00
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello Action - Struts2 学习实验台</title>
2026-03-18 15:18:30 +08:00
<style>
2026-03-18 18:12:20 +08:00
body {
margin: 0;
2026-03-18 15:18:30 +08:00
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
2026-03-18 18:12:20 +08:00
font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
background: linear-gradient(135deg, #1464c7 0%, #3f8df7 52%, #f68b1f 100%);
color: #122033;
2026-03-18 15:18:30 +08:00
}
.card {
2026-03-18 18:12:20 +08:00
width: min(860px, calc(100vw - 32px));
background: rgba(255,255,255,0.94);
border: 1px solid rgba(255,255,255,0.45);
border-radius: 30px;
padding: 30px;
box-shadow: 0 24px 60px rgba(0,0,0,0.24);
}
.eyebrow {
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: #1464c7;
font-weight: 800;
}
h1 {
margin: 12px 0;
font-size: 42px;
line-height: 1.12;
}
p {
margin: 0;
color: #53667d;
line-height: 1.9;
}
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
margin-top: 20px;
}
.panel {
padding: 18px;
2026-03-18 15:18:30 +08:00
border-radius: 20px;
2026-03-18 18:12:20 +08:00
background: #f6f9fd;
border: 1px solid #dbe5f0;
2026-03-18 15:18:30 +08:00
}
2026-03-18 18:12:20 +08:00
.panel h3 {
margin: 0 0 8px;
font-size: 18px;
2026-03-18 15:18:30 +08:00
}
2026-03-18 18:12:20 +08:00
.panel code {
2026-03-18 15:18:30 +08:00
display: inline-block;
2026-03-18 18:12:20 +08:00
margin-top: 8px;
padding: 4px 8px;
border-radius: 10px;
background: #e8f2ff;
color: #1464c7;
}
.actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
margin-top: 24px;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 18px;
border-radius: 999px;
2026-03-18 15:18:30 +08:00
text-decoration: none;
2026-03-18 18:12:20 +08:00
font-weight: 700;
}
.btn-primary { background: #1464c7; color: #fff; }
.btn-soft { background: #e8f2ff; color: #1464c7; }
@media (max-width: 720px) {
.grid { grid-template-columns: 1fr; }
2026-03-18 15:18:30 +08:00
}
</style>
</head>
<body>
<div class="card">
2026-03-18 18:12:20 +08:00
<div class="eyebrow">Hello Action</div>
<h1><s:property value="message" default="Hello from Struts2!"/></h1>
<p>这个页面用最短路径演示经典的 request -> action -> result 流程。你传入一个 name 参数Action 处理后再交给 JSP 结果页渲染。</p>
2026-03-18 18:12:20 +08:00
<div class="grid">
<section class="panel">
<h3>刚刚发生了什么</h3>
2026-03-18 18:12:20 +08:00
<p><s:property value="tip" default="The action populated a few view properties before returning SUCCESS."/></p>
</section>
<section class="panel">
<h3>建议下一步</h3>
2026-03-18 18:12:20 +08:00
<p><s:property value="nextStep" default="Open the login flow next."/></p>
</section>
<section class="panel">
<h3>再试一个请求</h3>
<p>你可以换一个查询参数,观察问候语如何跟着变化。</p>
2026-03-18 18:12:20 +08:00
<code><s:property value="requestSample" default="/hello?name=Platform%20Team"/></code>
</section>
<section class="panel">
<h3>当前输入</h3>
<p>name 参数值:<strong><s:property value="name" default="World"/></strong></p>
2026-03-18 18:12:20 +08:00
</section>
</div>
<div class="actions">
<a class="btn btn-primary" href="hello.action?name=Platform%20Team">用示例参数再运行一次</a>
<a class="btn btn-soft" href="loginPage.action">进入登录实验</a>
<a class="btn btn-soft" href="index.action">返回门户</a>
2026-03-18 18:12:20 +08:00
</div>
2026-03-18 15:18:30 +08:00
</div>
</body>
2026-03-18 18:12:20 +08:00
</html>