Update: web.xml and generated files
This commit is contained in:
58
web/user/form.jsp
Normal file
58
web/user/form.jsp
Normal file
@@ -0,0 +1,58 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>用户表单 - Struts2 Demo</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||
min-height: 100vh;
|
||||
padding: 20px;
|
||||
}
|
||||
.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);
|
||||
}
|
||||
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%;
|
||||
padding: 14px;
|
||||
background: #f5576c;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
94
web/user/login.jsp
Normal file
94
web/user/login.jsp
Normal file
@@ -0,0 +1,94 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>用户登录 - Struts2 Demo</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.login-box {
|
||||
background: white;
|
||||
padding: 40px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 15px 50px rgba(0,0,0,0.3);
|
||||
width: 400px;
|
||||
}
|
||||
h2 { color: #333; margin-bottom: 30px; text-align: center; }
|
||||
.form-group { margin-bottom: 20px; }
|
||||
label { display: block; margin-bottom: 8px; color: #555; font-weight: 500; }
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
input:focus { border-color: #667eea; outline: none; }
|
||||
.error { color: #e53935; font-size: 0.85em; margin-top: 5px; }
|
||||
.error-field { border-color: #e53935 !important; }
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
button:hover { background: #764ba2; }
|
||||
.tips {
|
||||
background: #e8f5e9;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 0.9em;
|
||||
color: #2e7d32;
|
||||
}
|
||||
a { color: #667eea; text-decoration: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-box">
|
||||
<h2>🔐 用户登录</h2>
|
||||
|
||||
<div class="tips">
|
||||
<strong>测试账号:</strong> admin / 123456
|
||||
</div>
|
||||
|
||||
<!-- Struts2 表单标签 -->
|
||||
<s:form action="login" method="post" namespace="/">
|
||||
<div class="form-group">
|
||||
<label>用户名</label>
|
||||
<s:textfield name="username" placeholder="请输入用户名" cssClass="%{hasErrors('username') ? 'error-field' : ''}"/>
|
||||
<s:fielderror fieldName="username"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>密码</label>
|
||||
<s:password name="password" placeholder="请输入密码" showPassword="true"/>
|
||||
<s:fielderror fieldName="password"/>
|
||||
</div>
|
||||
|
||||
<!-- 显示 Action 错误消息 -->
|
||||
<s:actionerror/>
|
||||
|
||||
<button type="submit">登录</button>
|
||||
</s:form>
|
||||
|
||||
<p style="text-align:center;margin-top:20px;">
|
||||
<a href="index.jsp">← 返回首页</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
44
web/user/success.jsp
Normal file
44
web/user/success.jsp
Normal file
@@ -0,0 +1,44 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>登录成功 - Struts2 Demo</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.card {
|
||||
background: white;
|
||||
padding: 40px;
|
||||
border-radius: 15px;
|
||||
text-align: center;
|
||||
box-shadow: 0 15px 50px rgba(0,0,0,0.3);
|
||||
}
|
||||
h1 { color: #11998e; font-size: 3em; margin-bottom: 20px; }
|
||||
p { color: #666; font-size: 1.2em; margin-bottom: 30px; }
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 12px 30px;
|
||||
background: #11998e;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 25px;
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
.btn:hover { transform: scale(1.05); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h1>✅ 登录成功!</h1>
|
||||
<p>欢迎回来,<s:property value="username"/>!</p>
|
||||
<a href="../index.jsp" class="btn">返回首页</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user