<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
<head>
    <title>用户表单 - Struts2</title>
    <style>
        body { font-family: Arial, sans-serif; max-width: 500px; margin: 50px auto; padding: 20px; }
        h1 { color: #e74c3c; }
        .form-group { margin: 15px 0; }
        label { display: block; margin-bottom: 5px; font-weight: bold; }
        input { width: 100%; padding: 10px; font-size: 14px; box-sizing: border-box; }
        button { background: #3498db; color: white; padding: 12px 24px; border: none; cursor: pointer; margin-top: 10px; }
        button:hover { background: #2980b9; }
    </style>
</head>
<body>
    <h1><s:if test="user.id == null">添加用户</s:if><s:else>编辑用户</s:else></h1>
    
    <s:form action="%{user.id == null ? 'user_add' : 'user_update'}" method="post">
        <s:hidden name="user.id"/>
        
        <div class="form-group">
            <label>姓名:</label>
            <s:textfield name="user.name" placeholder="请输入姓名"/>
        </div>
        
        <div class="form-group">
            <label>邮箱:</label>
            <s:textfield name="user.email" placeholder="请输入邮箱"/>
        </div>
        
        <div class="form-group">
            <label>年龄:</label>
            <s:textfield name="user.age" placeholder="请输入年龄"/>
        </div>
        
        <button type="submit">保存</button>
    </s:form>
    
    <p><a href="user">← 返回用户列表</a></p>
</body>
</html>