diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..19cb994 --- /dev/null +++ b/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + com.example + struts2-scaffold + 1.0.0 + war + + 17 + 17 + + + + org.apache.struts + struts2-core + 6.4.0 + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + + + diff --git a/src/main/java/com/example/struts2/ActionLifecycleAction.java b/src/main/java/com/example/struts2/ActionLifecycleAction.java new file mode 100644 index 0000000..24cfbf5 --- /dev/null +++ b/src/main/java/com/example/struts2/ActionLifecycleAction.java @@ -0,0 +1,325 @@ +package com.example.struts2; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; +import com.google.gson.Gson; +import java.io.PrintWriter; +import java.io.IOException; +import java.util.*; + +/** + * Action生命周期可视化Action - 展示请求处理完整流程 + * + * 学习点: + * - Action的完整生命周期 + * - 拦截器链的执行过程 + * - 结果渲染流程 + */ +public class ActionLifecycleAction extends ActionSupport { + + private static final Gson gson = new Gson(); + private static List lifecycleLog = new ArrayList<>(); + + /** + * 显示生命周期可视化页面 + */ + public String execute() { + return SUCCESS; + } + + /** + * 获取Action生命周期流程(AJAX) + */ + public String getLifecycle() { + Map result = new LinkedHashMap<>(); + List> stages = new ArrayList<>(); + + // 阶段1: 请求接收 + Map stage1 = new LinkedHashMap<>(); + stage1.put("id", 1); + stage1.put("name", "请求接收"); + stage1.put("icon", "📨"); + stage1.put("description", "客户端发送HTTP请求,被Servlet容器接收"); + stage1.put("components", Arrays.asList("HttpServletRequest", "HttpServletResponse")); + stage1.put("details", "请求URL、参数、Header等信息被封装到请求对象中"); + stages.add(stage1); + + // 阶段2: Filter处理 + Map stage2 = new LinkedHashMap<>(); + stage2.put("id", 2); + stage2.put("name", "Filter处理"); + stage2.put("icon", "🛡️"); + stage2.put("description", "StrutsPrepareAndExecuteFilter接管请求"); + stage2.put("components", Arrays.asList("StrutsPrepareAndExecuteFilter", "ActionContextCleanUp")); + stage2.put("details", "过滤器准备ActionContext,设置值栈,创建ActionProxy"); + stages.add(stage2); + + // 阶段3: ActionProxy创建 + Map stage3 = new LinkedHashMap<>(); + stage3.put("id", 3); + stage3.put("name", "ActionProxy创建"); + stage3.put("icon", "🔧"); + stage3.put("description", "根据URL映射创建ActionProxy和ActionInvocation"); + stage3.put("components", Arrays.asList("ActionProxy", "ActionInvocation", "Configuration")); + stage3.put("details", "从struts.xml查找Action配置,确定拦截器栈和结果映射"); + stages.add(stage3); + + // 阶段4: 拦截器前置处理 + Map stage4 = new LinkedHashMap<>(); + stage4.put("id", 4); + stage4.put("name", "拦截器前置处理"); + stage4.put("icon", "⛓️"); + stage4.put("description", "按顺序执行拦截器的intercept方法"); + stage4.put("components", Arrays.asList("Interceptor", "InterceptorStack")); + stage4.put("details", "执行日志、权限、校验等前置处理,可中断请求流程"); + stages.add(stage4); + + // 阶段5: Action执行 + Map stage5 = new LinkedHashMap<>(); + stage5.put("id", 5); + stage5.put("name", "Action执行"); + stage5.put("icon", "⚡"); + stage5.put("description", "调用Action的execute或其他指定方法"); + stage5.put("components", Arrays.asList("Action", "ActionSupport", "ModelDriven")); + stage5.put("details", "执行业务逻辑,操作数据库,返回结果字符串"); + stages.add(stage5); + + // 阶段6: 拦截器后置处理 + Map stage6 = new LinkedHashMap<>(); + stage6.put("id", 6); + stage6.put("name", "拦截器后置处理"); + stage6.put("icon", "↩️"); + stage6.put("description", "拦截器链返回,执行后置处理"); + stage6.put("components", Arrays.asList("Interceptor", "Result")); + stage6.put("details", "记录执行时间,处理结果,进行资源清理"); + stages.add(stage6); + + // 阶段7: 结果渲染 + Map stage7 = new LinkedHashMap<>(); + stage7.put("id", 7); + stage7.put("name", "结果渲染"); + stage7.put("icon", "🎨"); + stage7.put("description", "根据返回的结果字符串查找并执行Result"); + stage7.put("components", Arrays.asList("Result", "ServletDispatcherResult", "JSP")); + stage7.put("details", "转发或重定向到视图页面,渲染响应内容"); + stages.add(stage7); + + // 阶段8: 响应返回 + Map stage8 = new LinkedHashMap<>(); + stage8.put("id", 8); + stage8.put("name", "响应返回"); + stage8.put("icon", "📤"); + stage8.put("description", "将渲染后的响应返回给客户端"); + stage8.put("components", Arrays.asList("HttpServletResponse", "OutputStream")); + stage8.put("details", "清理ActionContext,释放资源,完成请求处理"); + stages.add(stage8); + + result.put("stages", stages); + result.put("totalStages", stages.size()); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取拦截器链执行流程(AJAX) + */ + public String getInterceptorChain() { + Map result = new LinkedHashMap<>(); + List> interceptors = new ArrayList<>(); + + // 框架级拦截器 + Map i1 = new LinkedHashMap<>(); + i1.put("name", "TimerInterceptor"); + i1.put("type", "framework"); + i1.put("description", "记录Action执行时间"); + i1.put("phase", "前后"); + interceptors.add(i1); + + Map i2 = new LinkedHashMap<>(); + i2.put("name", "LoggerInterceptor"); + i2.put("type", "framework"); + i2.put("description", "记录请求日志"); + i2.put("phase", "前置"); + interceptors.add(i2); + + Map i3 = new LinkedHashMap<>(); + i3.put("name", "ParametersInterceptor"); + i3.put("type", "framework"); + i3.put("description", "将请求参数设置到Action"); + i3.put("phase", "前置"); + interceptors.add(i3); + + Map i4 = new LinkedHashMap<>(); + i4.put("name", "ValidationInterceptor"); + i4.put("type", "framework"); + i4.put("description", "执行数据验证"); + i4.put("phase", "前置"); + interceptors.add(i4); + + Map i5 = new LinkedHashMap<>(); + i5.put("name", "WorkflowInterceptor"); + i5.put("type", "framework"); + i5.put("description", "处理验证错误,返回input结果"); + i5.put("phase", "前置"); + interceptors.add(i5); + + // 自定义拦截器 + Map i6 = new LinkedHashMap<>(); + i6.put("name", "LoggingInterceptor"); + i6.put("type", "custom"); + i6.put("description", "自定义日志拦截器"); + i6.put("phase", "前后"); + interceptors.add(i6); + + Map i7 = new LinkedHashMap<>(); + i7.put("name", "TimingInterceptor"); + i7.put("type", "custom"); + i7.put("description", "自定义计时拦截器"); + i7.put("phase", "前后"); + interceptors.add(i7); + + Map i8 = new LinkedHashMap<>(); + i8.put("name", "RateLimitInterceptor"); + i8.put("type", "custom"); + i8.put("description", "限流拦截器"); + i8.put("phase", "前置"); + interceptors.add(i8); + + result.put("interceptors", interceptors); + result.put("chainPattern", "责任链模式"); + result.put("executionOrder", "先入后出(递归调用)"); + + writeJsonResponse(result); + return NONE; + } + + /** + * 模拟请求执行过程(AJAX) + */ + public String simulateRequest() { + Map result = new LinkedHashMap<>(); + List> logs = new ArrayList<>(); + + long startTime = System.currentTimeMillis(); + + // 模拟每个阶段的执行 + String[] stages = { + "接收请求: GET /user/list", + "Filter: StrutsPrepareAndExecuteFilter.doFilter()", + "创建ActionProxy: UserFormAction.list()", + "创建ActionInvocation", + "▶️ 开始拦截器链", + " → TimerInterceptor.before()", + " → LoggerInterceptor.before()", + " → ParametersInterceptor.before()", + " → ValidationInterceptor.before()", + " → LoggingInterceptor.before()", + " → TimingInterceptor.before()", + "▶️ 执行Action: UserFormAction.list()", + " → 查询用户列表", + " → 设置userList到值栈", + " → 返回结果: SUCCESS", + "↩️ 拦截器链返回", + " → TimingInterceptor.after()", + " → LoggingInterceptor.after()", + " → ValidationInterceptor.after()", + " → ParametersInterceptor.after()", + " → LoggerInterceptor.after()", + " → TimerInterceptor.after()", + "▶️ 结果渲染: /user-list.jsp", + " → OGNL解析值栈数据", + " → 渲染JSP页面", + " → 返回响应", + "✅ 请求完成" + }; + + for (int i = 0; i < stages.length; i++) { + Map log = new LinkedHashMap<>(); + log.put("step", i + 1); + log.put("message", stages[i]); + log.put("timestamp", startTime + i * 10); + log.put("indent", stages[i].startsWith(" ") ? 2 : (stages[i].startsWith("→") ? 1 : 0)); + logs.add(log); + } + + result.put("logs", logs); + result.put("totalTime", stages.length * 10); + result.put("interceptorCount", 6); + result.put("actionTime", 10); + result.put("renderTime", 20); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取值栈信息(AJAX) + */ + public String getValueStack() { + Map result = new LinkedHashMap<>(); + + List> stack = new ArrayList<>(); + + Map root = new LinkedHashMap<>(); + root.put("name", "CompoundRoot"); + root.put("type", "root"); + root.put("description", "值栈的根对象列表"); + root.put("objects", Arrays.asList( + mapOf("name", "当前Action", "type", "UserFormAction", "properties", "userList, user, id"), + mapOf("name", "模型对象", "type", "User", "properties", "id, name, email, age") + )); + stack.add(root); + + Map context = new LinkedHashMap<>(); + context.put("name", "ActionContext"); + context.put("type", "context"); + context.put("description", "Action上下文"); + context.put("objects", Arrays.asList( + mapOf("name", "request", "type", "HttpServletRequest", "properties", "参数、Header、Attribute"), + mapOf("name", "session", "type", "HttpSession", "properties", "会话数据"), + mapOf("name", "application", "type", "ServletContext", "properties", "应用级数据"), + mapOf("name", "parameters", "type", "Map", "properties", "请求参数"), + mapOf("name", "attr", "type", "Map", "properties", "属性查找") + )); + stack.add(context); + + result.put("stack", stack); + result.put("ognl", "OGNL表达式用于访问值栈中的数据"); + result.put("examples", Arrays.asList( + "user.name - 访问Action的user对象的name属性", + "#session.user - 访问session中的user", + "#request.ip - 访问request中的ip属性", + "userList.size() - 调用userList的size方法" + )); + + writeJsonResponse(result); + return NONE; + } + + /** + * 辅助方法:创建Map + */ + private Map mapOf(String... pairs) { + Map map = new LinkedHashMap<>(); + for (int i = 0; i < pairs.length; i += 2) { + map.put(pairs[i], pairs[i + 1]); + } + return map; + } + + /** + * 辅助方法:写入JSON响应 + */ + private void writeJsonResponse(Map data) { + try { + ServletActionContext.getResponse().setContentType("application/json;charset=UTF-8"); + PrintWriter out = ServletActionContext.getResponse().getWriter(); + out.print(gson.toJson(data)); + out.flush(); + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/example/struts2/AjaxDemoAction.java b/src/main/java/com/example/struts2/AjaxDemoAction.java new file mode 100644 index 0000000..d4acafa --- /dev/null +++ b/src/main/java/com/example/struts2/AjaxDemoAction.java @@ -0,0 +1,126 @@ +package com.example.struts2; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; +import com.google.gson.Gson; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +/** + * AJAX演示Action - 展示Struts2处理异步请求 + * + * 学习点: + * - 返回JSON数据 + * - 处理AJAX请求 + * - 前后端分离交互 + */ +public class AjaxDemoAction extends ActionSupport { + + private String username; + private String email; + private Integer age; + private Long userId; + + // Gson用于JSON序列化 + private static final Gson gson = new Gson(); + + /** + * 检查用户名是否可用(AJAX验证) + */ + public String checkUsername() { + Map result = new HashMap<>(); + + // 模拟数据库检查 + boolean available = !"admin".equals(username) && !"root".equals(username); + + result.put("available", available); + result.put("message", available ? "用户名可用" : "用户名已被占用"); + result.put("username", username); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取用户统计信息 + */ + public String getStats() { + Map stats = new HashMap<>(); + stats.put("totalUsers", 156); + stats.put("activeUsers", 89); + stats.put("newUsersToday", 12); + stats.put("timestamp", System.currentTimeMillis()); + + writeJsonResponse(stats); + return NONE; + } + + /** + * 模拟保存用户(AJAX提交) + */ + public String saveUser() { + Map result = new HashMap<>(); + + // 模拟验证 + if (username == null || username.trim().isEmpty()) { + result.put("success", false); + result.put("error", "用户名不能为空"); + } else if (email == null || !email.contains("@")) { + result.put("success", false); + result.put("error", "邮箱格式不正确"); + } else { + // 模拟保存成功 + result.put("success", true); + result.put("message", "用户保存成功"); + result.put("userId", System.currentTimeMillis()); + result.put("username", username); + } + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取实时数据(模拟) + */ + public String getRealtimeData() { + Map data = new HashMap<>(); + data.put("serverTime", new java.util.Date().toString()); + data.put("requestsPerSecond", Math.random() * 100); + data.put("memoryUsage", Runtime.getRuntime().totalMemory() / 1024 / 1024); + data.put("activeSessions", (int)(Math.random() * 50) + 10); + + writeJsonResponse(data); + return NONE; + } + + /** + * 辅助方法:写入JSON响应 + */ + private void writeJsonResponse(Map data) { + try { + ServletActionContext.getResponse().setContentType("application/json;charset=UTF-8"); + PrintWriter out = ServletActionContext.getResponse().getWriter(); + out.print(gson.toJson(data)); + out.flush(); + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + // Getters and Setters + public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } + + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + + public Integer getAge() { return age; } + public void setAge(Integer age) { this.age = age; } + + public Long getUserId() { return userId; } + public void setUserId(Long userId) { this.userId = userId; } +} diff --git a/src/main/java/com/example/struts2/ClassLoaderAction.java b/src/main/java/com/example/struts2/ClassLoaderAction.java new file mode 100644 index 0000000..5671f94 --- /dev/null +++ b/src/main/java/com/example/struts2/ClassLoaderAction.java @@ -0,0 +1,319 @@ +package com.example.struts2; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; +import com.google.gson.Gson; +import java.io.PrintWriter; +import java.io.IOException; +import java.util.*; + +/** + * 类加载可视化Action - 展示JVM类加载机制 + * + * 学习点: + * - 类加载器层次结构(Bootstrap -> Extension -> Application) + * - 类的加载过程 + * - 双亲委派模型 + */ +public class ClassLoaderAction extends ActionSupport { + + private static final Gson gson = new Gson(); + private Map classLoaderInfo; + private List> loadedClasses; + + /** + * 显示类加载可视化页面 + */ + public String execute() { + return SUCCESS; + } + + /** + * 获取类加载器层次结构信息(AJAX) + */ + public String getClassLoaderHierarchy() { + Map result = new LinkedHashMap<>(); + + // 获取当前类的类加载器 + ClassLoader appLoader = this.getClass().getClassLoader(); + ClassLoader extLoader = appLoader.getParent(); + ClassLoader bootstrapLoader = extLoader != null ? extLoader.getParent() : null; + + List> hierarchy = new ArrayList<>(); + + // Bootstrap ClassLoader + Map bootstrap = new LinkedHashMap<>(); + bootstrap.put("name", "Bootstrap ClassLoader"); + bootstrap.put("type", "bootstrap"); + bootstrap.put("description", "启动类加载器 - 加载核心Java类(rt.jar)"); + bootstrap.put("loadedClasses", getBootstrapClasses()); + bootstrap.put("parent", null); + hierarchy.add(bootstrap); + + // Extension ClassLoader + if (extLoader != null) { + Map extension = new LinkedHashMap<>(); + extension.put("name", "Extension ClassLoader"); + extension.put("type", "extension"); + extension.put("description", "扩展类加载器 - 加载扩展类(ext目录)"); + extension.put("className", extLoader.getClass().getName()); + extension.put("loadedClasses", countLoadedClasses(extLoader)); + extension.put("parent", "Bootstrap ClassLoader"); + hierarchy.add(extension); + } + + // Application ClassLoader + Map application = new LinkedHashMap<>(); + application.put("name", "Application ClassLoader"); + application.put("type", "application"); + application.put("description", "应用类加载器 - 加载classpath下的类"); + application.put("className", appLoader.getClass().getName()); + application.put("loadedClasses", countLoadedClasses(appLoader)); + application.put("parent", extLoader != null ? "Extension ClassLoader" : "Bootstrap ClassLoader"); + hierarchy.add(application); + + // 当前Web应用的类加载器(如果是Web应用) + ClassLoader threadLoader = Thread.currentThread().getContextClassLoader(); + if (threadLoader != appLoader) { + Map web = new LinkedHashMap<>(); + web.put("name", "WebApp ClassLoader"); + web.put("type", "webapp"); + web.put("description", "Web应用类加载器 - 加载WEB-INF/classes和lib下的类"); + web.put("className", threadLoader.getClass().getName()); + web.put("loadedClasses", "动态加载"); + web.put("parent", "Application ClassLoader"); + hierarchy.add(web); + } + + result.put("hierarchy", hierarchy); + result.put("currentClassLoader", this.getClass().getClassLoader().getClass().getName()); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取已加载的类列表(AJAX) + */ + public String getLoadedClasses() { + Map result = new LinkedHashMap<>(); + List> classes = new ArrayList<>(); + + // 获取一些重要的Struts2相关类 + String[] classNames = { + "com.opensymphony.xwork2.ActionSupport", + "org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter", + "com.opensymphony.xwork2.interceptor.AbstractInterceptor", + "org.apache.struts2.components.Component", + "com.opensymphony.xwork2.util.ValueStack", + "ognl.Ognl", + "com.example.struts2.HelloAction", + "com.example.struts2.CalculatorAction" + }; + + for (String className : classNames) { + try { + Class clazz = Class.forName(className); + Map classInfo = new LinkedHashMap<>(); + classInfo.put("name", className); + classInfo.put("simpleName", clazz.getSimpleName()); + classInfo.put("classLoader", clazz.getClassLoader() != null ? + clazz.getClassLoader().getClass().getSimpleName() : "Bootstrap"); + classInfo.put("package", clazz.getPackage().getName()); + classInfo.put("superclass", clazz.getSuperclass() != null ? + clazz.getSuperclass().getSimpleName() : "None"); + classInfo.put("interfaces", getInterfacesNames(clazz)); + classInfo.put("loadedTime", "运行时已加载"); + classes.add(classInfo); + } catch (ClassNotFoundException e) { + // 类未找到,跳过 + } + } + + result.put("classes", classes); + result.put("totalCount", classes.size()); + + writeJsonResponse(result); + return NONE; + } + + /** + * 模拟类加载过程(AJAX) + */ + public String simulateClassLoading() { + Map result = new LinkedHashMap<>(); + List> steps = new ArrayList<>(); + + // 步骤1: 加载 + Map step1 = new LinkedHashMap<>(); + step1.put("step", 1); + step1.put("name", "加载 (Loading)"); + step1.put("description", "通过类的全限定名获取二进制字节流,将静态存储结构转化为方法区的运行时数据结构"); + step1.put("action", "查找.class文件 -> 读取字节码 -> 创建Class对象"); + step1.put("icon", "📂"); + steps.add(step1); + + // 步骤2: 验证 + Map step2 = new LinkedHashMap<>(); + step2.put("step", 2); + step2.put("name", "验证 (Verification)"); + step2.put("description", "确保字节码符合JVM规范,不会危害虚拟机安全"); + step2.put("action", "文件格式验证 -> 元数据验证 -> 字节码验证 -> 符号引用验证"); + step2.put("icon", "✅"); + steps.add(step2); + + // 步骤3: 准备 + Map step3 = new LinkedHashMap<>(); + step3.put("step", 3); + step3.put("name", "准备 (Preparation)"); + step3.put("description", "为类的静态变量分配内存并设置默认初始值"); + step3.put("action", "分配静态变量内存 -> 设置默认值(int=0, boolean=false, reference=null)"); + step3.put("icon", "📝"); + steps.add(step3); + + // 步骤4: 解析 + Map step4 = new LinkedHashMap<>(); + step4.put("step", 4); + step4.put("name", "解析 (Resolution)"); + step4.put("description", "将常量池内的符号引用替换为直接引用"); + step4.put("action", "类/接口解析 -> 字段解析 -> 方法解析 -> 接口方法解析"); + step4.put("icon", "🔗"); + steps.add(step4); + + // 步骤5: 初始化 + Map step5 = new LinkedHashMap<>(); + step5.put("step", 5); + step5.put("name", "初始化 (Initialization)"); + step5.put("description", "执行类构造器()方法,为静态变量赋予正确的初始值"); + step5.put("action", "执行静态代码块 -> 初始化静态变量 -> 类完全可用"); + step5.put("icon", "🚀"); + steps.add(step5); + + result.put("steps", steps); + result.put("totalSteps", steps.size()); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取Struts2框架核心类的加载信息 + */ + public String getStrutsClassesInfo() { + Map result = new LinkedHashMap<>(); + List> modules = new ArrayList<>(); + + // Action模块 + Map actionModule = new LinkedHashMap<>(); + actionModule.put("name", "Action模块"); + actionModule.put("description", "处理用户请求的核心组件"); + actionModule.put("classes", Arrays.asList( + createClassInfo("ActionSupport", "提供了Action的基础实现", "com.opensymphony.xwork2"), + createClassInfo("ActionContext", "Action的上下文环境", "com.opensymphony.xwork2"), + createClassInfo("ServletActionContext", "与Servlet集成的上下文", "org.apache.struts2"), + createClassInfo("ActionInvocation", "Action调用链", "com.opensymphony.xwork2") + )); + modules.add(actionModule); + + // 拦截器模块 + Map interceptorModule = new LinkedHashMap<>(); + interceptorModule.put("name", "拦截器模块"); + interceptorModule.put("description", "在Action执行前后进行增强处理"); + interceptorModule.put("classes", Arrays.asList( + createClassInfo("AbstractInterceptor", "拦截器基类", "com.opensymphony.xwork2.interceptor"), + createClassInfo("Interceptor", "拦截器接口", "com.opensymphony.xwork2.interceptor"), + createClassInfo("ActionInvocation", "拦截器链调用", "com.opensymphony.xwork2"), + createClassInfo("DefaultActionInvocation", "默认实现", "com.opensymphony.xwork2") + )); + modules.add(interceptorModule); + + // OGNL模块 + Map ognlModule = new LinkedHashMap<>(); + ognlModule.put("name", "OGNL模块"); + ognlModule.put("description", "对象图导航语言,用于数据绑定"); + ognlModule.put("classes", Arrays.asList( + createClassInfo("Ognl", "OGNL核心类", "ognl"), + createClassInfo("OgnlContext", "OGNL上下文", "ognl"), + createClassInfo("ValueStack", "值栈", "com.opensymphony.xwork2.util"), + createClassInfo("CompoundRoot", "复合根对象", "com.opensymphony.xwork2.util") + )); + modules.add(ognlModule); + + // 结果处理模块 + Map resultModule = new LinkedHashMap<>(); + resultModule.put("name", "结果处理模块"); + resultModule.put("description", "处理Action执行结果"); + resultModule.put("classes", Arrays.asList( + createClassInfo("Result", "结果接口", "com.opensymphony.xwork2"), + createClassInfo("ServletDispatcherResult", "Servlet转发结果", "org.apache.struts2.dispatcher"), + createClassInfo("ServletRedirectResult", "重定向结果", "org.apache.struts2.dispatcher"), + createClassInfo("StreamResult", "流结果", "org.apache.struts2.dispatcher") + )); + modules.add(resultModule); + + result.put("modules", modules); + + writeJsonResponse(result); + return NONE; + } + + /** + * 辅助方法:创建类信息 + */ + private Map createClassInfo(String name, String desc, String pkg) { + Map info = new LinkedHashMap<>(); + info.put("name", name); + info.put("description", desc); + info.put("package", pkg); + return info; + } + + /** + * 辅助方法:获取接口名称列表 + */ + private List getInterfacesNames(Class clazz) { + List interfaces = new ArrayList<>(); + for (Class iface : clazz.getInterfaces()) { + interfaces.add(iface.getSimpleName()); + } + return interfaces; + } + + /** + * 辅助方法:统计已加载的类数量 + */ + private String countLoadedClasses(ClassLoader loader) { + // 实际项目中可以使用Instrumentation API获取准确数字 + return "动态加载"; + } + + /** + * 辅助方法:获取Bootstrap加载的核心类 + */ + private List getBootstrapClasses() { + return Arrays.asList("java.lang.Object", "java.lang.String", "java.lang.System", + "java.util.ArrayList", "java.util.HashMap", "java.io.File"); + } + + /** + * 辅助方法:写入JSON响应 + */ + private void writeJsonResponse(Map data) { + try { + ServletActionContext.getResponse().setContentType("application/json;charset=UTF-8"); + PrintWriter out = ServletActionContext.getResponse().getWriter(); + out.print(gson.toJson(data)); + out.flush(); + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + // Getters and Setters + public Map getClassLoaderInfo() { return classLoaderInfo; } + public void setClassLoaderInfo(Map classLoaderInfo) { this.classLoaderInfo = classLoaderInfo; } + + public List> getLoadedClasses() { return loadedClasses; } + public void setLoadedClasses(List> loadedClasses) { this.loadedClasses = loadedClasses; } +} diff --git a/src/main/java/com/example/struts2/FileUploadAction.java b/src/main/java/com/example/struts2/FileUploadAction.java new file mode 100644 index 0000000..3a8c00f --- /dev/null +++ b/src/main/java/com/example/struts2/FileUploadAction.java @@ -0,0 +1,216 @@ +package com.example.struts2; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * 文件上传Action - 演示Struts2文件上传功能 + * + * 学习点: + * - 文件上传配置 + * - 多文件上传 + * - 文件类型和大小限制 + */ +public class FileUploadAction extends ActionSupport { + + // 单文件上传字段 + private File upload; + private String uploadFileName; + private String uploadContentType; + private String description; + + // 多文件上传字段 + private File[] uploads; + private String[] uploadsFileName; + private String[] uploadsContentType; + + // 上传结果 + private Map uploadResult; + private String uploadedFilePath; + + // 上传目录 + private static final String UPLOAD_DIR = "/tmp/struts2-uploads/"; + + /** + * 显示上传页面 + */ + public String execute() { + return SUCCESS; + } + + /** + * 处理单文件上传 + */ + public String uploadSingle() { + uploadResult = new HashMap<>(); + + if (upload == null) { + uploadResult.put("success", false); + uploadResult.put("error", "请选择要上传的文件"); + return SUCCESS; + } + + try { + // 创建上传目录 + File dir = new File(UPLOAD_DIR); + if (!dir.exists()) { + dir.mkdirs(); + } + + // 生成唯一文件名 + String uniqueFileName = UUID.randomUUID().toString() + "_" + uploadFileName; + File destFile = new File(dir, uniqueFileName); + + // 保存文件 + copyFile(upload, destFile); + + uploadedFilePath = destFile.getAbsolutePath(); + + uploadResult.put("success", true); + uploadResult.put("message", "文件上传成功"); + uploadResult.put("originalName", uploadFileName); + uploadResult.put("savedName", uniqueFileName); + uploadResult.put("fileSize", upload.length()); + uploadResult.put("contentType", uploadContentType); + uploadResult.put("filePath", uploadedFilePath); + uploadResult.put("description", description); + + } catch (Exception e) { + uploadResult.put("success", false); + uploadResult.put("error", "上传失败: " + e.getMessage()); + } + + return SUCCESS; + } + + /** + * 处理多文件上传 + */ + public String uploadMultiple() { + uploadResult = new HashMap<>(); + + if (uploads == null || uploads.length == 0) { + uploadResult.put("success", false); + uploadResult.put("error", "请选择要上传的文件"); + return SUCCESS; + } + + Map[] files = new HashMap[uploads.length]; + int successCount = 0; + + try { + File dir = new File(UPLOAD_DIR); + if (!dir.exists()) { + dir.mkdirs(); + } + + for (int i = 0; i < uploads.length; i++) { + Map fileInfo = new HashMap<>(); + + if (uploads[i] != null) { + String uniqueFileName = UUID.randomUUID().toString() + "_" + uploadsFileName[i]; + File destFile = new File(dir, uniqueFileName); + + copyFile(uploads[i], destFile); + + fileInfo.put("originalName", uploadsFileName[i]); + fileInfo.put("savedName", uniqueFileName); + fileInfo.put("fileSize", uploads[i].length()); + fileInfo.put("contentType", uploadsContentType[i]); + fileInfo.put("success", true); + successCount++; + } else { + fileInfo.put("success", false); + fileInfo.put("error", "文件为空"); + } + + files[i] = fileInfo; + } + + uploadResult.put("success", true); + uploadResult.put("message", "成功上传 " + successCount + " 个文件"); + uploadResult.put("totalFiles", uploads.length); + uploadResult.put("successCount", successCount); + uploadResult.put("files", files); + + } catch (Exception e) { + uploadResult.put("success", false); + uploadResult.put("error", "上传失败: " + e.getMessage()); + } + + return SUCCESS; + } + + /** + * 文件复制辅助方法 + */ + private void copyFile(File src, File dest) throws IOException { + try (FileInputStream fis = new FileInputStream(src); + FileOutputStream fos = new FileOutputStream(dest)) { + byte[] buffer = new byte[1024]; + int length; + while ((length = fis.read(buffer)) > 0) { + fos.write(buffer, 0, length); + } + } + } + + @Override + public void validate() { + // 可以在这里添加文件大小和类型的验证 + if (upload != null) { + // 限制文件大小为10MB + if (upload.length() > 10 * 1024 * 1024) { + addFieldError("upload", "文件大小不能超过10MB"); + } + + // 限制文件类型 + String[] allowedTypes = {"image/jpeg", "image/png", "image/gif", "application/pdf", "text/plain"}; + boolean allowed = false; + for (String type : allowedTypes) { + if (type.equals(uploadContentType)) { + allowed = true; + break; + } + } + if (!allowed) { + addFieldError("upload", "不支持的文件类型: " + uploadContentType); + } + } + } + + // Getters and Setters + public File getUpload() { return upload; } + public void setUpload(File upload) { this.upload = upload; } + + public String getUploadFileName() { return uploadFileName; } + public void setUploadFileName(String uploadFileName) { this.uploadFileName = uploadFileName; } + + public String getUploadContentType() { return uploadContentType; } + public void setUploadContentType(String uploadContentType) { this.uploadContentType = uploadContentType; } + + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } + + public File[] getUploads() { return uploads; } + public void setUploads(File[] uploads) { this.uploads = uploads; } + + public String[] getUploadsFileName() { return uploadsFileName; } + public void setUploadsFileName(String[] uploadsFileName) { this.uploadsFileName = uploadsFileName; } + + public String[] getUploadsContentType() { return uploadsContentType; } + public void setUploadsContentType(String[] uploadsContentType) { this.uploadsContentType = uploadsContentType; } + + public Map getUploadResult() { return uploadResult; } + public void setUploadResult(Map uploadResult) { this.uploadResult = uploadResult; } + + public String getUploadedFilePath() { return uploadedFilePath; } + public void setUploadedFilePath(String uploadedFilePath) { this.uploadedFilePath = uploadedFilePath; } +} diff --git a/src/main/java/com/example/struts2/OgnlVisualAction.java b/src/main/java/com/example/struts2/OgnlVisualAction.java new file mode 100644 index 0000000..d27c435 --- /dev/null +++ b/src/main/java/com/example/struts2/OgnlVisualAction.java @@ -0,0 +1,299 @@ +package com.example.struts2; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; +import com.google.gson.Gson; +import ognl.Ognl; +import ognl.OgnlContext; +import ognl.OgnlException; +import java.io.PrintWriter; +import java.io.IOException; +import java.util.*; + +/** + * OGNL可视化Action - 交互式学习OGNL表达式 + * + * 学习点: + * - OGNL语法和表达式 + * - 值栈访问机制 + * - 集合操作和投影 + */ +public class OgnlVisualAction extends ActionSupport { + + private static final Gson gson = new Gson(); + private String expression; + private Object result; + private String error; + + // 测试数据 + private User user; + private List users; + private Map context; + + public OgnlVisualAction() { + // 初始化测试数据 + user = new User(1L, "张三", "zhangsan@example.com", 25, + new Address("北京", "朝阳区", "100000")); + + users = Arrays.asList( + new User(1L, "张三", "zhangsan@example.com", 25, new Address("北京", "朝阳区", "100000")), + new User(2L, "李四", "lisi@example.com", 30, new Address("上海", "浦东新区", "200000")), + new User(3L, "王五", "wangwu@example.com", 28, new Address("广州", "天河区", "510000")), + new User(4L, "赵六", "zhaoliu@example.com", 35, new Address("深圳", "南山区", "518000")) + ); + + context = new HashMap<>(); + context.put("sessionUser", user); + context.put("appName", "Struts2学习平台"); + context.put("version", "1.0.0"); + } + + /** + * 显示OGNL可视化页面 + */ + public String execute() { + return SUCCESS; + } + + /** + * 执行OGNL表达式(AJAX) + */ + public String executeExpression() { + Map response = new LinkedHashMap<>(); + + try { + // 创建OGNL上下文 + OgnlContext ognlContext = new OgnlContext(); + ognlContext.setRoot(user); + ognlContext.putAll(context); + + // 解析并执行表达式 + Object expr = Ognl.parseExpression(expression); + Object value = Ognl.getValue(expr, ognlContext, user); + + response.put("success", true); + response.put("expression", expression); + response.put("result", value); + response.put("resultType", value != null ? value.getClass().getSimpleName() : "null"); + + } catch (OgnlException e) { + response.put("success", false); + response.put("expression", expression); + response.put("error", e.getMessage()); + } + + writeJsonResponse(response); + return NONE; + } + + /** + * 获取OGNL示例(AJAX) + */ + public String getExamples() { + Map result = new LinkedHashMap<>(); + List> examples = new ArrayList<>(); + + // 基础表达式 + addExample(examples, "基础属性访问", "user.name", + "访问user对象的name属性", "张三"); + addExample(examples, "链式属性访问", "user.address.city", + "访问嵌套对象的属性", "北京"); + addExample(examples, "方法调用", "user.getName()", + "调用getter方法", "张三"); + addExample(examples, "静态方法", "@java.lang.Math@random()", + "调用静态方法", "随机数"); + + // 集合操作 + addExample(examples, "集合大小", "users.size()", + "获取集合大小", "4"); + addExample(examples, "集合过滤", "users.{? #this.age > 25}", + "过滤年龄大于25的用户", "[李四, 王五, 赵六]"); + addExample(examples, "集合投影", "users.{name}", + "提取所有用户的姓名", "[张三, 李四, 王五, 赵六]"); + addExample(examples, "集合选择", "users.{^ #this.age > 25}", + "选择第一个符合条件的元素", "李四"); + addExample(examples, "集合选择", "users.{$ #this.age > 25}", + "选择最后一个符合条件的元素", "赵六"); + + // 上下文访问 + addExample(examples, "上下文变量", "#sessionUser.name", + "访问上下文中的sessionUser", "张三"); + addExample(examples, "根对象", "#root", + "访问根对象", "User对象"); + addExample(examples, "this引用", "users.{#this.name}", + "在投影中使用this引用", "[张三, 李四, 王五, 赵六]"); + + // 高级操作 + addExample(examples, "创建集合", "{1, 2, 3, 4, 5}", + "创建List集合", "[1, 2, 3, 4, 5]"); + addExample(examples, "创建Map", "#{'name':'张三', 'age':25}", + "创建Map对象", "{name=张三, age=25}"); + addExample(examples, "投影+过滤", "users.{? #this.age > 25}.{name}", + "先过滤再投影", "[李四, 王五, 赵六]"); + addExample(examples, "Lambda表达式", "users.stream().filter(u -> u.age > 25).count()", + "使用Stream API", "3"); + + result.put("examples", examples); + result.put("totalExamples", examples.size()); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取测试数据(AJAX) + */ + public String getTestData() { + Map result = new LinkedHashMap<>(); + + result.put("user", user); + result.put("users", users); + result.put("context", context); + + writeJsonResponse(result); + return NONE; + } + + /** + * 获取OGNL语法树(AJAX) + */ + public String getSyntaxTree() { + Map result = new LinkedHashMap<>(); + List> nodes = new ArrayList<>(); + + // 根节点 + Map root = new LinkedHashMap<>(); + root.put("id", "root"); + root.put("name", "OGNL表达式"); + root.put("type", "root"); + root.put("children", Arrays.asList( + createNode("property", "属性访问", "user.name, user.age"), + createNode("method", "方法调用", "user.getName(), users.size()"), + createNode("collection", "集合操作", "users.{name}, users.{? #this.age > 25}"), + createNode("context", "上下文访问", "#sessionUser, #root"), + createNode("static", "静态访问", "@java.lang.Math@PI"), + createNode("constructor", "构造创建", "new com.example.User(), {1,2,3}") + )); + nodes.add(root); + + result.put("nodes", nodes); + result.put("description", "OGNL表达式语法树结构"); + + writeJsonResponse(result); + return NONE; + } + + /** + * 辅助方法:创建节点 + */ + private Map createNode(String id, String name, String example) { + Map node = new LinkedHashMap<>(); + node.put("id", id); + node.put("name", name); + node.put("example", example); + return node; + } + + /** + * 辅助方法:添加示例 + */ + private void addExample(List> examples, String category, + String expression, String description, String result) { + Map example = new LinkedHashMap<>(); + example.put("category", category); + example.put("expression", expression); + example.put("description", description); + example.put("expectedResult", result); + examples.add(example); + } + + /** + * 辅助方法:写入JSON响应 + */ + private void writeJsonResponse(Map data) { + try { + ServletActionContext.getResponse().setContentType("application/json;charset=UTF-8"); + PrintWriter out = ServletActionContext.getResponse().getWriter(); + out.print(gson.toJson(data)); + out.flush(); + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + // Getters and Setters + public String getExpression() { return expression; } + public void setExpression(String expression) { this.expression = expression; } + + public Object getResult() { return result; } + public void setResult(Object result) { this.result = result; } + + public String getError() { return error; } + public void setError(String error) { this.error = error; } + + public User getUser() { return user; } + public void setUser(User user) { this.user = user; } + + public List getUsers() { return users; } + public void setUsers(List users) { this.users = users; } + + public Map getContext() { return context; } + public void setContext(Map context) { this.context = context; } + + /** + * 内部类:用户实体 + */ + public static class User { + private Long id; + private String name; + private String email; + private Integer age; + private Address address; + + public User() {} + + public User(Long id, String name, String email, Integer age, Address address) { + this.id = id; + this.name = name; + this.email = email; + this.age = age; + this.address = address; + } + + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + public Integer getAge() { return age; } + public void setAge(Integer age) { this.age = age; } + public Address getAddress() { return address; } + public void setAddress(Address address) { this.address = address; } + } + + /** + * 内部类:地址实体 + */ + public static class Address { + private String city; + private String district; + private String zipCode; + + public Address() {} + + public Address(String city, String district, String zipCode) { + this.city = city; + this.district = district; + this.zipCode = zipCode; + } + + public String getCity() { return city; } + public void setCity(String city) { this.city = city; } + public String getDistrict() { return district; } + public void setDistrict(String district) { this.district = district; } + public String getZipCode() { return zipCode; } + public void setZipCode(String zipCode) { this.zipCode = zipCode; } + } +} diff --git a/src/main/resources/struts.xml b/src/main/resources/struts.xml index d5ae109..d2bbfcf 100644 --- a/src/main/resources/struts.xml +++ b/src/main/resources/struts.xml @@ -122,5 +122,83 @@ user + + + /ajax-demo.jsp + + + + + + + + + + + + + + + + + + + + + /file-upload.jsp + + + + /file-upload.jsp + /file-upload.jsp + + + + /file-upload.jsp + /file-upload.jsp + + + + + /classloader-visual.jsp + + + + + + + + + + + + + + + + + + + + + /lifecycle-visual.jsp + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..8cb6967 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,26 @@ + + + + Struts2 Scaffold + + + + struts2 + org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter + + + + struts2 + /* + + + + + index.jsp + + + \ No newline at end of file diff --git a/src/main/webapp/ajax-demo.jsp b/src/main/webapp/ajax-demo.jsp new file mode 100644 index 0000000..f347480 --- /dev/null +++ b/src/main/webapp/ajax-demo.jsp @@ -0,0 +1,321 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + + AJAX演示 - Struts2异步交互 + + + +
+
+

🚀 AJAX演示 - Struts2异步交互

+

学习Struts2如何处理AJAX请求并返回JSON数据

+
+ + + +
+ 🧪 实验任务 +
    +
  • 在"用户名检查"中输入"admin"或"root",观察AJAX实时验证
  • +
  • 点击"获取统计数据",查看后端返回的JSON数据
  • +
  • 使用"AJAX表单提交",体验无刷新表单提交
  • +
  • 观察"实时数据"面板,了解如何定时获取服务器数据
  • +
+
+ +
+ +
+

👤 用户名实时检查

+
+ + +
+
+
+
+ + +
+

📊 获取统计数据

+ +
+
+
+ + +
+

📝 AJAX表单提交

+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + +
+

⏱️ 实时数据监控

+ + + +
+
+
+ +
+

📚 学习要点

+
    +
  • 返回JSON: Action中通过 ServletActionContext.getResponse().getWriter() 直接输出JSON
  • +
  • 不返回result: AJAX Action返回 NONE,不经过视图层
  • +
  • 异步验证: 使用 onblur 事件触发AJAX验证,提升用户体验
  • +
  • 定时刷新: 使用 setInterval 实现实时数据监控
  • +
  • Fetch API: 现代浏览器推荐使用 fetch 替代 XMLHttpRequest
  • +
+
+
+ + + + diff --git a/src/main/webapp/classloader-visual.jsp b/src/main/webapp/classloader-visual.jsp new file mode 100644 index 0000000..020c2e2 --- /dev/null +++ b/src/main/webapp/classloader-visual.jsp @@ -0,0 +1,406 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + + 类加载可视化 - JVM类加载机制 + + + +
+
+

🔍 类加载可视化

+

深入理解JVM类加载机制和Struts2框架的类加载过程

+
+ + + +
+ 🧪 实验任务 +
    +
  • 观察类加载器层次结构,理解双亲委派模型
  • +
  • 点击类加载步骤,查看每个阶段的详细说明
  • +
  • 查看已加载的类,了解Struts2核心类的加载信息
  • +
  • 探索Struts2模块,理解框架的模块化设计
  • +
+
+ +
+ +
+

🏗️ 类加载器层次结构

+
+
+ 加载中... +
+
+
+ + +
+

📋 类加载步骤(点击展开)

+
+
+ 加载中... +
+
+
+ + +
+

📦 已加载的核心类

+
+
+ 加载中... +
+
+
+ + +
+

🎯 Struts2核心模块

+
+
+ 加载中... +
+
+
+
+ +
+

📚 学习要点

+
    +
  • 类加载器层次: Bootstrap → Extension → Application → WebApp,形成双亲委派模型
  • +
  • 双亲委派: 类加载时先委托父加载器,父加载器无法加载时才自己加载
  • +
  • 加载过程: 加载 → 验证 → 准备 → 解析 → 初始化,五个阶段确保类正确加载
  • +
  • Struts2类加载: 框架类由Application加载器加载,应用类由WebApp加载器加载
  • +
  • 热部署: WebApp类加载器可以重新加载修改后的类,实现热部署
  • +
+
+
+ + + + diff --git a/src/main/webapp/file-upload.jsp b/src/main/webapp/file-upload.jsp new file mode 100644 index 0000000..2379b64 --- /dev/null +++ b/src/main/webapp/file-upload.jsp @@ -0,0 +1,217 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + + 文件上传 - Struts2 + + + +
+
+

📁 文件上传演示

+

学习Struts2如何处理文件上传,包括单文件、多文件上传和文件验证

+
+ + + +
+ 🧪 实验任务 +
    +
  • 使用"单文件上传"上传一个图片或文档,观察上传结果
  • +
  • 使用"多文件上传"一次性选择多个文件
  • +
  • 尝试上传超过10MB的文件,观察验证错误
  • +
  • 尝试上传不支持的文件类型(如.exe),观察类型验证
  • +
+
+ + +
+

📄 单文件上传

+ +
+ + + +
+ +
+ + +
+ + +
+ + + +
+ ✓ 上传成功 +
+
+
+ 原始文件名: + +
+
+ 保存文件名: + +
+
+ 文件大小: + 字节 +
+
+ 文件类型: + +
+
+ 描述: + +
+
+ 保存路径: + +
+
+
+ +
+ ✗ 上传失败: +
+
+
+
+ + +
+

📁 多文件上传

+ +
+ + +
+ + +
+ + + +
+ +
+
+

上传的文件列表:

+ + + + + + + + + + + + + + + +
文件名大小类型状态
字节 + + ✓ 成功 + + + + +
+
+
+ +
+ ✗ 上传失败: +
+
+
+
+ + +
+

📚 学习要点

+
    +
  • 文件字段命名: 表单中的文件字段名必须与Action中的属性名一致(如 upload
  • +
  • 三个属性: Action需要提供 File uploadString uploadFileNameString uploadContentType
  • +
  • 多文件上传: 使用数组形式 File[] uploadsString[] uploadsFileName
  • +
  • 表单enctype: 必须设置 enctype="multipart/form-data"
  • +
  • 文件验证: 可以在 validate() 方法中检查文件大小和类型
  • +
  • 文件保存: 使用 FileUtils.copyFile() 或手动流操作保存文件
  • +
+ +
+ 💡 提示 +
    +
  • 上传的文件默认保存在临时目录,需要手动移动到目标位置
  • +
  • 建议生成唯一文件名避免冲突(如使用UUID)
  • +
  • 生产环境应该限制上传目录的访问权限
  • +
  • 大文件上传需要考虑分片上传和进度显示
  • +
+
+
+
+ + diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index f89c0dd..0ffda50 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -71,6 +71,16 @@

通过错误示例/正确示例切换,直观看到字段错误、input 返回和成功路径的区别。

进入实验室 +
+

🚀 AJAX 异步交互

+

学习Struts2如何处理AJAX请求,返回JSON数据,实现前后端分离交互。

+ AJAX演示 +
+
+

📁 文件上传

+

演示单文件、多文件上传,文件类型和大小验证,以及文件处理流程。

+ 文件上传 +
diff --git a/src/main/webapp/learn.jsp b/src/main/webapp/learn.jsp index 5d299ba..eee5932 100644 --- a/src/main/webapp/learn.jsp +++ b/src/main/webapp/learn.jsp @@ -72,6 +72,16 @@

学习为什么校验失败不会直接 500,而是回到 input 页面并显示字段级错误。

打开验证实验室
+
+

🚀 AJAX 异步交互

+

学习Struts2如何处理AJAX请求,返回JSON数据,实现无刷新交互和实时数据更新。

+ 打开AJAX演示 +
+
+

📁 文件上传

+

演示单文件和多文件上传,学习文件类型验证、大小限制和文件处理流程。

+ 打开文件上传 +

📚 学习路径

diff --git a/src/main/webapp/lifecycle-visual.jsp b/src/main/webapp/lifecycle-visual.jsp new file mode 100644 index 0000000..4ce4342 --- /dev/null +++ b/src/main/webapp/lifecycle-visual.jsp @@ -0,0 +1,457 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + + Action生命周期可视化 - Struts2请求处理流程 + + + +
+
+

⚡ Action生命周期可视化

+

深入理解Struts2处理HTTP请求的完整流程

+
+ + + +
+ 🧪 实验任务 +
    +
  • 点击生命周期阶段,查看每个阶段的详细说明和涉及的组件
  • +
  • 观察拦截器链,理解责任链模式的执行顺序
  • +
  • 点击模拟请求执行,观看完整的请求处理流程
  • +
  • 查看值栈结构,理解OGNL如何访问数据
  • +
+
+ +
+ +
+

📋 Action生命周期流程(点击查看详情)

+
+
加载中...
+
+
+ + +
+

⛓️ 拦截器链执行顺序

+
+
+
加载中...
+
+
+ + +
+

🎬 模拟请求执行

+
+ + +
+
+
点击"开始模拟"观看请求处理流程...
+
+
+ + +
+

📚 值栈(ValueStack)结构

+
+
加载中...
+
+
+
+ +
+

📖 学习要点

+
    +
  • 请求入口: 所有请求先经过StrutsPrepareAndExecuteFilter过滤器
  • +
  • ActionProxy: 封装Action的调用信息,包含拦截器栈配置
  • +
  • 拦截器链: 使用责任链模式,前置处理顺序执行,后置处理逆序执行
  • +
  • 值栈: OGNL表达式的根对象,包含Action和上下文数据
  • +
  • 结果渲染: 根据返回字符串查找对应的Result进行视图渲染
  • +
  • 线程安全: 每个请求创建新的Action实例,不存在线程安全问题
  • +
+
+
+ + + + diff --git a/src/main/webapp/ognl-visual.jsp b/src/main/webapp/ognl-visual.jsp new file mode 100644 index 0000000..e4e7671 --- /dev/null +++ b/src/main/webapp/ognl-visual.jsp @@ -0,0 +1,507 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + + OGNL表达式可视化 - 对象图导航语言 + + + +
+
+

🎯 OGNL表达式可视化

+

交互式学习对象图导航语言(Object-Graph Navigation Language)

+
+ + + +
+ 🧪 实验任务 +
    +
  • 表达式编辑器中输入OGNL表达式,观察执行结果
  • +
  • 点击示例列表中的表达式,快速学习各种语法
  • +
  • 查看测试数据结构,了解可以访问的数据
  • +
  • 尝试组合使用过滤、投影等高级操作
  • +
+
+ +
+ +
+

✏️ 表达式编辑器

+
+ +
+ + +
+
+ +

执行结果

+
+
输入表达式并点击"执行"查看结果
+
+ +
+ 快速插入: + user.name + user.address.city + users.size() + users.{name} + 过滤 + #sessionUser +
+
+ + +
+

📚 OGNL示例库(点击使用)

+
+
加载中...
+
+
+ + +
+

📦 测试数据结构

+
+
加载中...
+
+
+ + +
+

🌲 OGNL语法类型

+
+
加载中...
+
+ +
+ 💡 提示 +
    +
  • 属性访问: 使用点号(.)访问对象属性,如 user.name
  • +
  • 方法调用: 直接调用方法,如 user.getName() 或 users.size()
  • +
  • 集合投影: 使用.{prop}提取属性列表,如 users.{name}
  • +
  • 集合过滤: 使用.{? condition}过滤元素
  • +
  • 上下文访问: 使用#访问上下文变量,如 #sessionUser
  • +
  • 静态访问: 使用@访问静态成员,如 @java.lang.Math@PI
  • +
+
+
+
+ +
+

📖 学习要点

+
    +
  • 值栈根对象: Action对象默认在值栈顶部,可以直接访问其属性
  • +
  • OGNL上下文: 包含request、session、application等Web对象
  • +
  • 类型转换: OGNL自动进行字符串到目标类型的转换
  • +
  • 集合操作: 支持过滤(?)、投影(.{})、选择(^/$)等高级操作
  • +
  • Lambda支持: 可以使用Lambda表达式进行复杂操作
  • +
  • 安全性: OGNL功能强大,注意防范OGNL注入攻击
  • +
+
+
+ + + + diff --git a/struts2.log b/struts2.log new file mode 100644 index 0000000..03a39aa --- /dev/null +++ b/struts2.log @@ -0,0 +1,19 @@ +SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". +SLF4J: Defaulting to no-operation (NOP) logger implementation +SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. +WARNING: jetty-runner is deprecated. + See Jetty Documentation for startup options + https://www.eclipse.org/jetty/documentation/ +2026-03-07T05:07:01.035940650Z main ERROR Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console... +[MonitorInterceptor] 初始化 - Sat Mar 07 05:07:04 UTC 2026 +[LoggingInterceptor] 进入 Action: , Method: execute +[TimingInterceptor] 执行时间: 1115.90789 ms +[LoggingInterceptor] 退出 Action: , Result: success, 耗时: 1124ms +[LoggingInterceptor] 进入 Action: , Method: execute +[TimingInterceptor] 执行时间: 46.49766 ms +[LoggingInterceptor] 退出 Action: , Result: success, 耗时: 47ms +[LoggingInterceptor] 进入 Action: , Method: execute +[TimingInterceptor] 执行时间: 36.518364 ms +[LoggingInterceptor] 退出 Action: , Result: success, 耗时: 37ms +[MonitorInterceptor] 销毁 - Sat Mar 07 05:36:55 UTC 2026 +[MonitorInterceptor] 最终统计: {=3} diff --git a/target/classes/com/example/struts2/CalculatorAction.class b/target/classes/com/example/struts2/CalculatorAction.class new file mode 100644 index 0000000..f7ff106 Binary files /dev/null and b/target/classes/com/example/struts2/CalculatorAction.class differ diff --git a/target/classes/com/example/struts2/HelloAction.class b/target/classes/com/example/struts2/HelloAction.class new file mode 100644 index 0000000..31dc531 Binary files /dev/null and b/target/classes/com/example/struts2/HelloAction.class differ diff --git a/target/classes/com/example/struts2/InterceptorDemoAction.class b/target/classes/com/example/struts2/InterceptorDemoAction.class new file mode 100644 index 0000000..325a36b Binary files /dev/null and b/target/classes/com/example/struts2/InterceptorDemoAction.class differ diff --git a/target/classes/com/example/struts2/LearnAction.class b/target/classes/com/example/struts2/LearnAction.class new file mode 100644 index 0000000..1a88bec Binary files /dev/null and b/target/classes/com/example/struts2/LearnAction.class differ diff --git a/target/classes/com/example/struts2/OgnlLabAction$DemoUser.class b/target/classes/com/example/struts2/OgnlLabAction$DemoUser.class new file mode 100644 index 0000000..dbd9365 Binary files /dev/null and b/target/classes/com/example/struts2/OgnlLabAction$DemoUser.class differ diff --git a/target/classes/com/example/struts2/OgnlLabAction.class b/target/classes/com/example/struts2/OgnlLabAction.class new file mode 100644 index 0000000..48e232b Binary files /dev/null and b/target/classes/com/example/struts2/OgnlLabAction.class differ diff --git a/target/classes/com/example/struts2/UserFormAction$User.class b/target/classes/com/example/struts2/UserFormAction$User.class new file mode 100644 index 0000000..878bd9d Binary files /dev/null and b/target/classes/com/example/struts2/UserFormAction$User.class differ diff --git a/target/classes/com/example/struts2/UserFormAction.class b/target/classes/com/example/struts2/UserFormAction.class new file mode 100644 index 0000000..ae86ec2 Binary files /dev/null and b/target/classes/com/example/struts2/UserFormAction.class differ diff --git a/target/classes/com/example/struts2/ValidationLabAction.class b/target/classes/com/example/struts2/ValidationLabAction.class new file mode 100644 index 0000000..5f13d05 Binary files /dev/null and b/target/classes/com/example/struts2/ValidationLabAction.class differ diff --git a/target/classes/com/example/struts2/interceptor/LoggingInterceptor.class b/target/classes/com/example/struts2/interceptor/LoggingInterceptor.class new file mode 100644 index 0000000..42c51b7 Binary files /dev/null and b/target/classes/com/example/struts2/interceptor/LoggingInterceptor.class differ diff --git a/target/classes/com/example/struts2/interceptor/MonitorInterceptor.class b/target/classes/com/example/struts2/interceptor/MonitorInterceptor.class new file mode 100644 index 0000000..c27bd89 Binary files /dev/null and b/target/classes/com/example/struts2/interceptor/MonitorInterceptor.class differ diff --git a/target/classes/com/example/struts2/interceptor/RateLimitInterceptor.class b/target/classes/com/example/struts2/interceptor/RateLimitInterceptor.class new file mode 100644 index 0000000..3f91755 Binary files /dev/null and b/target/classes/com/example/struts2/interceptor/RateLimitInterceptor.class differ diff --git a/target/classes/com/example/struts2/interceptor/TimingInterceptor.class b/target/classes/com/example/struts2/interceptor/TimingInterceptor.class new file mode 100644 index 0000000..707d59e Binary files /dev/null and b/target/classes/com/example/struts2/interceptor/TimingInterceptor.class differ diff --git a/target/classes/com/example/struts2/interceptor/ValidationInterceptor.class b/target/classes/com/example/struts2/interceptor/ValidationInterceptor.class new file mode 100644 index 0000000..9b9f3b7 Binary files /dev/null and b/target/classes/com/example/struts2/interceptor/ValidationInterceptor.class differ diff --git a/target/classes/struts.xml b/target/classes/struts.xml new file mode 100644 index 0000000..d5ae109 --- /dev/null +++ b/target/classes/struts.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + + + + + + + + + + + + /error-rate-limit.jsp + /error-invalid-input.jsp + + + + + /index.jsp + + + + /hello.jsp + + + + /learn.jsp + + + + /interceptor-demo.jsp + + + + /ognl-lab.jsp + + + + /ognl-lab.jsp + + + + /validation-lab.jsp + + + + submit + /validation-lab.jsp + /validation-lab.jsp + + + + + /interceptor-demo.jsp + + + + /calculator.jsp + /calculator.jsp + + + + /calculator.jsp + /calculator.jsp + + + + /user-list.jsp + + + + user_add + user + /user-form.jsp + + + + /user-form.jsp + + + + user_update + user + /user-form.jsp + + + + user + + + + \ No newline at end of file diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..99eb15f --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=struts2-scaffold +groupId=com.example +version=1.0.0 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..49ae983 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,14 @@ +com/example/struts2/interceptor/LoggingInterceptor.class +com/example/struts2/InterceptorDemoAction.class +com/example/struts2/CalculatorAction.class +com/example/struts2/OgnlLabAction.class +com/example/struts2/interceptor/RateLimitInterceptor.class +com/example/struts2/HelloAction.class +com/example/struts2/LearnAction.class +com/example/struts2/interceptor/ValidationInterceptor.class +com/example/struts2/OgnlLabAction$DemoUser.class +com/example/struts2/UserFormAction$User.class +com/example/struts2/interceptor/TimingInterceptor.class +com/example/struts2/ValidationLabAction.class +com/example/struts2/UserFormAction.class +com/example/struts2/interceptor/MonitorInterceptor.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..15eff02 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,10 @@ +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/interceptor/ValidationInterceptor.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/HelloAction.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/interceptor/LoggingInterceptor.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/UserFormAction.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/interceptor/MonitorInterceptor.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/LearnAction.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/interceptor/TimingInterceptor.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/InterceptorDemoAction.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/CalculatorAction.java +/home/llm/Projects/struts2-scaffold/src/main/java/com/example/struts2/interceptor/RateLimitInterceptor.java diff --git a/target/struts2-scaffold-1.0.0.war b/target/struts2-scaffold-1.0.0.war new file mode 100644 index 0000000..3772aec Binary files /dev/null and b/target/struts2-scaffold-1.0.0.war differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/CalculatorAction.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/CalculatorAction.class new file mode 100644 index 0000000..f7ff106 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/CalculatorAction.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/HelloAction.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/HelloAction.class new file mode 100644 index 0000000..31dc531 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/HelloAction.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/InterceptorDemoAction.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/InterceptorDemoAction.class new file mode 100644 index 0000000..325a36b Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/InterceptorDemoAction.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/LearnAction.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/LearnAction.class new file mode 100644 index 0000000..1a88bec Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/LearnAction.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/UserFormAction$User.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/UserFormAction$User.class new file mode 100644 index 0000000..61024d5 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/UserFormAction$User.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/UserFormAction.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/UserFormAction.class new file mode 100644 index 0000000..df78732 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/UserFormAction.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/LoggingInterceptor.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/LoggingInterceptor.class new file mode 100644 index 0000000..42c51b7 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/LoggingInterceptor.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/MonitorInterceptor.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/MonitorInterceptor.class new file mode 100644 index 0000000..c27bd89 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/MonitorInterceptor.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/RateLimitInterceptor.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/RateLimitInterceptor.class new file mode 100644 index 0000000..3f91755 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/RateLimitInterceptor.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/TimingInterceptor.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/TimingInterceptor.class new file mode 100644 index 0000000..707d59e Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/TimingInterceptor.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/ValidationInterceptor.class b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/ValidationInterceptor.class new file mode 100644 index 0000000..9b9f3b7 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/classes/com/example/struts2/interceptor/ValidationInterceptor.class differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/classes/struts.xml b/target/struts2-scaffold-1.0.0/WEB-INF/classes/struts.xml new file mode 100644 index 0000000..3643269 --- /dev/null +++ b/target/struts2-scaffold-1.0.0/WEB-INF/classes/struts.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + + + + + + + + + + + + /error-rate-limit.jsp + /error-invalid-input.jsp + + + + + /index.jsp + + + + /hello.jsp + + + + /learn.jsp + + + + /interceptor-demo.jsp + + + + + /interceptor-demo.jsp + + + + /calculator.jsp + + + + /calculator.jsp + /calculator.jsp + + + + /user-list.jsp + + + + user + + + + /user-form.jsp + + + + user + + + + user + + + + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/caffeine-2.9.3.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/caffeine-2.9.3.jar new file mode 100644 index 0000000..2c85a0d Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/caffeine-2.9.3.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/checker-qual-3.19.0.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/checker-qual-3.19.0.jar new file mode 100644 index 0000000..3ff12ce Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/checker-qual-3.19.0.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-fileupload-1.5.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-fileupload-1.5.jar new file mode 100644 index 0000000..5e60875 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-fileupload-1.5.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-io-2.15.1.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-io-2.15.1.jar new file mode 100644 index 0000000..d53be1f Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-io-2.15.1.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-lang3-3.14.0.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-lang3-3.14.0.jar new file mode 100644 index 0000000..da9302f Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-lang3-3.14.0.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-text-1.11.0.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-text-1.11.0.jar new file mode 100644 index 0000000..7815497 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/commons-text-1.11.0.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/error_prone_annotations-2.10.0.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/error_prone_annotations-2.10.0.jar new file mode 100644 index 0000000..2d1b543 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/error_prone_annotations-2.10.0.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/freemarker-2.3.32.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/freemarker-2.3.32.jar new file mode 100644 index 0000000..3a073d4 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/freemarker-2.3.32.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/javassist-3.29.0-GA.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/javassist-3.29.0-GA.jar new file mode 100644 index 0000000..aac2156 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/javassist-3.29.0-GA.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/log4j-api-2.23.1.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/log4j-api-2.23.1.jar new file mode 100644 index 0000000..0e8e3f5 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/log4j-api-2.23.1.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/ognl-3.3.4.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/ognl-3.3.4.jar new file mode 100644 index 0000000..0c9cefd Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/ognl-3.3.4.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/lib/struts2-core-6.4.0.jar b/target/struts2-scaffold-1.0.0/WEB-INF/lib/struts2-core-6.4.0.jar new file mode 100644 index 0000000..57413f8 Binary files /dev/null and b/target/struts2-scaffold-1.0.0/WEB-INF/lib/struts2-core-6.4.0.jar differ diff --git a/target/struts2-scaffold-1.0.0/WEB-INF/web.xml b/target/struts2-scaffold-1.0.0/WEB-INF/web.xml new file mode 100644 index 0000000..8cb6967 --- /dev/null +++ b/target/struts2-scaffold-1.0.0/WEB-INF/web.xml @@ -0,0 +1,26 @@ + + + + Struts2 Scaffold + + + + struts2 + org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter + + + + struts2 + /* + + + + + index.jsp + + + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/calculator.jsp b/target/struts2-scaffold-1.0.0/calculator.jsp new file mode 100644 index 0000000..de5dab5 --- /dev/null +++ b/target/struts2-scaffold-1.0.0/calculator.jsp @@ -0,0 +1,85 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + 计算器 - Struts2 表单示例 + + + +

🔢 计算器 - Struts2 表单示例

+ + +
+ 计算结果: + + + = +
+
+ +
+ 快速实验: + + + +
+ + +
+ + + +
+ +
+ + +
+ +
+ + + +
+ +
+ +
+
+ +
+ 学习点: +
    +
  • name 属性对应 Action 的 setter 方法
  • +
  • <s:fielderror> 显示验证错误
  • +
  • validate() 方法进行数据验证
  • +
+
+ +

← 返回学习中心

+ + + + diff --git a/target/struts2-scaffold-1.0.0/error-invalid-input.jsp b/target/struts2-scaffold-1.0.0/error-invalid-input.jsp new file mode 100644 index 0000000..17ace7b --- /dev/null +++ b/target/struts2-scaffold-1.0.0/error-invalid-input.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + 参数无效 + + + +
+

🚫 检测到无效参数

+

您的请求包含可疑内容,已被拦截。

+

此页面由 ValidationInterceptor 拦截器生成

+
+

← 返回学习中心

+ + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/error-rate-limit.jsp b/target/struts2-scaffold-1.0.0/error-rate-limit.jsp new file mode 100644 index 0000000..7d81b71 --- /dev/null +++ b/target/struts2-scaffold-1.0.0/error-rate-limit.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + 请求过于频繁 + + + +
+

⚠️ 请求过于频繁

+

您的请求次数超过限制,请稍后再试。

+

此页面由 RateLimitInterceptor 拦截器生成

+
+

← 返回学习中心

+ + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/hello.jsp b/target/struts2-scaffold-1.0.0/hello.jsp new file mode 100644 index 0000000..721bdfe --- /dev/null +++ b/target/struts2-scaffold-1.0.0/hello.jsp @@ -0,0 +1,8 @@ + + +Struts2 Scaffold + +

${message}

+

Struts2 脚手架部署中...

+ + diff --git a/target/struts2-scaffold-1.0.0/index.jsp b/target/struts2-scaffold-1.0.0/index.jsp new file mode 100644 index 0000000..a400693 --- /dev/null +++ b/target/struts2-scaffold-1.0.0/index.jsp @@ -0,0 +1,33 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + Struts2 Scaffold + + + +

🚀 Struts2 Scaffold

+

Struts2 学习脚手架已启动!

+ + + + + +

Powered by Struts2 + Jetty

+ + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/interceptor-demo.jsp b/target/struts2-scaffold-1.0.0/interceptor-demo.jsp new file mode 100644 index 0000000..8d8f939 --- /dev/null +++ b/target/struts2-scaffold-1.0.0/interceptor-demo.jsp @@ -0,0 +1,80 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + 拦截器演示 - Struts2 + + + +

🛡️ Struts2 拦截器演示

+ +
+ 实验观察点: +
    +
  • 连续刷新页面,观察 Action 调用次数如何累积
  • +
  • 切换到“API 限流栈”,理解为什么拦截器顺序会影响结果
  • +
  • 注意执行时间显示,这就是拦截器注入到 request 的数据
  • +
+
+ +
+

📊 执行统计

+

本次请求执行时间: ms

+ +

Action 调用统计:

+ + + + + + + + +
Action调用次数
+
+ +
+

🔗 拦截器链演示

+

当前使用: customStack (日志 + 计时 + 监控 + 默认栈)

+ 使用 API 限流栈 +

API 栈包含: 日志 + 限流 + 验证 + 计时 + 默认栈

+
+ +
+

📚 拦截器执行顺序

+
+请求 → LoggingInterceptor → TimingInterceptor → MonitorInterceptor → Action
+响应 ← LoggingInterceptor ← TimingInterceptor ← MonitorInterceptor ← Result
+        
+

注意: 拦截器像洋葱一样,先进入的后退出

+
+ +
+

💡 拦截器核心概念

+
    +
  • Interceptor 接口: init() → intercept() → destroy()
  • +
  • intercept() 方法: 调用 invocation.invoke() 继续链
  • +
  • 拦截器栈: 多个拦截器按顺序组成链
  • +
  • 责任链模式: 每个拦截器决定是否继续
  • +
+
+ +

← 返回学习中心

+ + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/learn.jsp b/target/struts2-scaffold-1.0.0/learn.jsp new file mode 100644 index 0000000..5c3746a --- /dev/null +++ b/target/struts2-scaffold-1.0.0/learn.jsp @@ -0,0 +1,112 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + Struts2 学习中心 + + + +

🎓 Struts2 学习中心

+ +
+ 🧪 学习任务卡 +
    +
  • 先点“拦截器演示”,观察执行统计和链路顺序
  • +
  • 再点“计算器”,故意输入非法值体验 Struts2 验证
  • +
  • 最后点“用户管理”,理解 Action + JSP + 表单提交流程
  • +
+ +
+ +
+

🛡️ 拦截器 (核心特性)

+

拦截器是 Struts2 最强大的特性之一,基于责任链模式实现 AOP。

+ + +
+ +
+

📝 基础示例

+ +
+ +

📚 学习路径

+ +
+

1. MVC 架构

+
    +
  • Model: Action 类 + JavaBean
  • +
  • View: JSP + Struts 标签库
  • +
  • Controller: StrutsPrepareAndExecuteFilter
  • +
+
+ +
+

2. 拦截器机制

+
    +
  • Interceptor 接口: init() → intercept() → destroy()
  • +
  • interceptor-stack: 组合多个拦截器
  • +
  • 执行顺序: 责任链模式(先入后出)
  • +
+
+ +
+

3. OGNL 表达式

+
    +
  • <s:property value="name"/> - 输出属性
  • +
  • <s:iterator value="list"> - 遍历集合
  • +
  • #request.key - 访问 request
  • +
+
+ +
+

4. 项目结构

+
+├── src/main/java/com/example/struts2/
+│   ├── action/          # Action 类
+│   └── interceptor/     # 自定义拦截器
+├── src/main/resources/
+│   └── struts.xml       # 核心配置
+└── src/main/webapp/
+    ├── WEB-INF/web.xml  # Servlet 配置
+    └── *.jsp            # 视图页面
+        
+
+ +

← 返回首页

+ + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/user-form.jsp b/target/struts2-scaffold-1.0.0/user-form.jsp new file mode 100644 index 0000000..88931bf --- /dev/null +++ b/target/struts2-scaffold-1.0.0/user-form.jsp @@ -0,0 +1,43 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + 用户表单 - Struts2 + + + +

添加用户编辑用户

+ + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ +

← 返回用户列表

+ + \ No newline at end of file diff --git a/target/struts2-scaffold-1.0.0/user-list.jsp b/target/struts2-scaffold-1.0.0/user-list.jsp new file mode 100644 index 0000000..19de15c --- /dev/null +++ b/target/struts2-scaffold-1.0.0/user-list.jsp @@ -0,0 +1,59 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + 用户管理 - Struts2 CRUD 示例 + + + +

👥 用户管理 - Struts2 CRUD 示例

+ +

+ 添加用户

+ + + + + + + + + + + + + + + + + + +
ID姓名邮箱年龄操作
+ 编辑 + 删除 +
+ +
+ 学习点: +
    +
  • <s:iterator> 遍历集合
  • +
  • redirectAction 结果类型实现 PRG 模式
  • +
  • 动态方法调用处理不同操作
  • +
+
+ +

← 返回学习中心

+ + \ No newline at end of file diff --git a/target/tmp/jsp/org/apache/jsp/calculator_jsp.class b/target/tmp/jsp/org/apache/jsp/calculator_jsp.class new file mode 100644 index 0000000..068cf92 Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/calculator_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/calculator_jsp.java b/target/tmp/jsp/org/apache/jsp/calculator_jsp.java new file mode 100644 index 0000000..a60fc05 --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/calculator_jsp.java @@ -0,0 +1,579 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 22:22:00 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class calculator_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fif_0026_005ftest; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fselect_0026_005fname_005flist_005fheaderValue_005fheaderKey_005fnobody; + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fselect_0026_005fname_005flist_005fheaderValue_005fheaderKey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + } + + public void _jspDestroy() { + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.release(); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.release(); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fselect_0026_005fname_005flist_005fheaderValue_005fheaderKey_005fnobody.release(); + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" 计算器 - Struts2 表单示例\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

🔢 计算器 - Struts2 表单示例

\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fif_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" 快速实验:\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write("
\n"); + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fform_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" 学习点:\n"); + out.write("
    \n"); + out.write("
  • name 属性对应 Action 的 setter 方法
  • \n"); + out.write("
  • <s:fielderror> 显示验证错误
  • \n"); + out.write("
  • validate() 方法进行数据验证
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("

← 返回学习中心

\n"); + out.write("\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } + + private boolean _jspx_meth_s_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:if + org.apache.struts2.views.jsp.IfTag _jspx_th_s_005fif_005f0 = (org.apache.struts2.views.jsp.IfTag) _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.get(org.apache.struts2.views.jsp.IfTag.class); + boolean _jspx_th_s_005fif_005f0_reused = false; + try { + _jspx_th_s_005fif_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fif_005f0.setParent(null); + // /calculator.jsp(26,4) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fif_005f0.setTest("result != null"); + int _jspx_eval_s_005fif_005f0 = _jspx_th_s_005fif_005f0.doStartTag(); + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fif_005f0); + } + do { + out.write("\n"); + out.write("
\n"); + out.write(" 计算结果: "); + if (_jspx_meth_s_005fproperty_005f0(_jspx_th_s_005fif_005f0, _jspx_page_context)) + return true; + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f1(_jspx_th_s_005fif_005f0, _jspx_page_context)) + return true; + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f2(_jspx_th_s_005fif_005f0, _jspx_page_context)) + return true; + out.write(" \n"); + out.write(" = "); + if (_jspx_meth_s_005fproperty_005f3(_jspx_th_s_005fif_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fif_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.reuse(_jspx_th_s_005fif_005f0); + _jspx_th_s_005fif_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fif_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fif_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f0 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f0_reused = false; + try { + _jspx_th_s_005fproperty_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fif_005f0); + // /calculator.jsp(28,18) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f0.setValue("num1"); + int _jspx_eval_s_005fproperty_005f0 = _jspx_th_s_005fproperty_005f0.doStartTag(); + if (_jspx_th_s_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f0); + _jspx_th_s_005fproperty_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f1 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f1_reused = false; + try { + _jspx_th_s_005fproperty_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fif_005f0); + // /calculator.jsp(29,12) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f1.setValue("operator"); + int _jspx_eval_s_005fproperty_005f1 = _jspx_th_s_005fproperty_005f1.doStartTag(); + if (_jspx_th_s_005fproperty_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f1); + _jspx_th_s_005fproperty_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f1, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f2 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f2_reused = false; + try { + _jspx_th_s_005fproperty_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fif_005f0); + // /calculator.jsp(30,12) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f2.setValue("num2"); + int _jspx_eval_s_005fproperty_005f2 = _jspx_th_s_005fproperty_005f2.doStartTag(); + if (_jspx_th_s_005fproperty_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f2); + _jspx_th_s_005fproperty_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f2, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f2_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f3 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f3_reused = false; + try { + _jspx_th_s_005fproperty_005f3.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fif_005f0); + // /calculator.jsp(31,14) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f3.setValue("result"); + int _jspx_eval_s_005fproperty_005f3 = _jspx_th_s_005fproperty_005f3.doStartTag(); + if (_jspx_th_s_005fproperty_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f3); + _jspx_th_s_005fproperty_005f3_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f3, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f3_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fform_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:form + org.apache.struts2.views.jsp.ui.FormTag _jspx_th_s_005fform_005f0 = (org.apache.struts2.views.jsp.ui.FormTag) _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.get(org.apache.struts2.views.jsp.ui.FormTag.class); + boolean _jspx_th_s_005fform_005f0_reused = false; + try { + _jspx_th_s_005fform_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fform_005f0.setParent(null); + // /calculator.jsp(42,4) name = action type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setAction("calc_execute"); + // /calculator.jsp(42,4) name = method type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setMethod("post"); + int _jspx_eval_s_005fform_005f0 = _jspx_th_s_005fform_005f0.doStartTag(); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fform_005f0); + } + do { + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fselect_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fform_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.reuse(_jspx_th_s_005fform_005f0); + _jspx_th_s_005fform_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fform_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fform_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f0 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f0_reused = false; + try { + _jspx_th_s_005ftextfield_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /calculator.jsp(45,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f0.setName("num1"); + // /calculator.jsp(45,12) null + _jspx_th_s_005ftextfield_005f0.setDynamicAttribute(null, "placeholder", "输入第一个数字"); + int _jspx_eval_s_005ftextfield_005f0 = _jspx_th_s_005ftextfield_005f0.doStartTag(); + if (_jspx_th_s_005ftextfield_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f0); + _jspx_th_s_005ftextfield_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f0 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f0_reused = false; + try { + _jspx_th_s_005ffielderror_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /calculator.jsp(46,12) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f0.setFieldName("num1"); + // /calculator.jsp(46,12) name = cssClass type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f0.setCssClass("error"); + int _jspx_eval_s_005ffielderror_005f0 = _jspx_th_s_005ffielderror_005f0.doStartTag(); + if (_jspx_th_s_005ffielderror_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody.reuse(_jspx_th_s_005ffielderror_005f0); + _jspx_th_s_005ffielderror_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fselect_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:select + org.apache.struts2.views.jsp.ui.SelectTag _jspx_th_s_005fselect_005f0 = (org.apache.struts2.views.jsp.ui.SelectTag) _005fjspx_005ftagPool_005fs_005fselect_0026_005fname_005flist_005fheaderValue_005fheaderKey_005fnobody.get(org.apache.struts2.views.jsp.ui.SelectTag.class); + boolean _jspx_th_s_005fselect_005f0_reused = false; + try { + _jspx_th_s_005fselect_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fselect_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /calculator.jsp(51,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fselect_005f0.setName("operator"); + // /calculator.jsp(51,12) name = list type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fselect_005f0.setList("{'+', '-', '*', '/'}"); + // /calculator.jsp(51,12) name = headerKey type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fselect_005f0.setHeaderKey(""); + // /calculator.jsp(51,12) name = headerValue type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fselect_005f0.setHeaderValue("选择运算符"); + int _jspx_eval_s_005fselect_005f0 = _jspx_th_s_005fselect_005f0.doStartTag(); + if (_jspx_th_s_005fselect_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fselect_0026_005fname_005flist_005fheaderValue_005fheaderKey_005fnobody.reuse(_jspx_th_s_005fselect_005f0); + _jspx_th_s_005fselect_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fselect_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fselect_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f1 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f1_reused = false; + try { + _jspx_th_s_005ftextfield_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /calculator.jsp(56,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f1.setName("num2"); + // /calculator.jsp(56,12) null + _jspx_th_s_005ftextfield_005f1.setDynamicAttribute(null, "placeholder", "输入第二个数字"); + int _jspx_eval_s_005ftextfield_005f1 = _jspx_th_s_005ftextfield_005f1.doStartTag(); + if (_jspx_th_s_005ftextfield_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f1); + _jspx_th_s_005ftextfield_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f1 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f1_reused = false; + try { + _jspx_th_s_005ffielderror_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /calculator.jsp(57,12) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f1.setFieldName("num2"); + // /calculator.jsp(57,12) name = cssClass type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f1.setCssClass("error"); + int _jspx_eval_s_005ffielderror_005f1 = _jspx_th_s_005ffielderror_005f1.doStartTag(); + if (_jspx_th_s_005ffielderror_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssClass_005fnobody.reuse(_jspx_th_s_005ffielderror_005f1); + _jspx_th_s_005ffielderror_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f1_reused); + } + return false; + } +} diff --git a/target/tmp/jsp/org/apache/jsp/hello_jsp.class b/target/tmp/jsp/org/apache/jsp/hello_jsp.class new file mode 100644 index 0000000..255eec7 Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/hello_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/hello_jsp.java b/target/tmp/jsp/org/apache/jsp/hello_jsp.java new file mode 100644 index 0000000..efcae44 --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/hello_jsp.java @@ -0,0 +1,170 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 11:40:01 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class hello_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + } + + public void _jspDestroy() { + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" Hello 示例 - Struts2\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("
\n"); + out.write("

👋 Hello 示例

\n"); + out.write("

"); + out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${message}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); + out.write("

\n"); + out.write("

这是 Struts2 最基础的一条链路:浏览器请求 /hello → Struts2 匹配 Action → Action 返回结果名 → JSP 被渲染。

\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 学习观察点\n"); + out.write("
    \n"); + out.write("
  • 访问 URL:/hello
  • \n"); + out.write("
  • 对应配置:struts.xml 里的 <action name=\"hello\" ...>
  • \n"); + out.write("
  • 对应控制器:HelloAction.execute()
  • \n"); + out.write("
  • 视图页面:当前这个 hello.jsp
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

🔍 为什么这个例子重要

\n"); + out.write("

很多人一开始学 Struts2,会直接被拦截器、标签库、OGNL、配置文件吓到。Hello 示例的价值在于:先把“请求如何进来、结果如何出去”这条最小主线跑通,再去理解更复杂的机制。

\n"); + out.write("
\n"); + out.write("\n"); + out.write("

← 返回学习中心

\n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } +} diff --git a/target/tmp/jsp/org/apache/jsp/index_jsp.class b/target/tmp/jsp/org/apache/jsp/index_jsp.class new file mode 100644 index 0000000..dd3ff3c Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/index_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/index_jsp.java b/target/tmp/jsp/org/apache/jsp/index_jsp.java new file mode 100644 index 0000000..3e23c0a --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/index_jsp.java @@ -0,0 +1,224 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 11:39:53 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + } + + public void _jspDestroy() { + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" Struts2 Learning Scaffold\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("
\n"); + out.write("

🚀 Struts2 Learning Scaffold

\n"); + out.write("

不是单纯的 Struts2 演示页,而是一套带任务卡、表单实验、拦截器观察和 CRUD 流程的学习脚手架。

\n"); + out.write(" 进入学习中心\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 推荐学习顺序\n"); + out.write("
    \n"); + out.write("
  • 第一步: 进入 Hello 示例,理解 Action → JSP 的最小闭环
  • \n"); + out.write("
  • 第二步: 进入 计算器,体验表单绑定、校验、错误回显
  • \n"); + out.write("
  • 第三步: 进入 拦截器演示,观察请求被增强的过程
  • \n"); + out.write("
  • 第四步: 进入 用户管理,学习列表/表单/增删改的完整流程
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

👋 Hello 示例

\n"); + out.write("

最小 Action 示例,适合理解 Struts2 如何把请求映射到 Action,再把数据渲染到 JSP。

\n"); + out.write(" 打开示例\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🔢 计算器实验

\n"); + out.write("

学习参数绑定、validate() 校验、字段错误回显,以及成功/失败两条分支。

\n"); + out.write(" 开始实验\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🛡️ 拦截器观察

\n"); + out.write("

重点模块。能看到日志、执行时间、限流、监控等拦截器如何织入请求链路。

\n"); + out.write(" 观察拦截器\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

👥 用户 CRUD

\n"); + out.write("

从列表页到表单页,再到新增/编辑/删除,形成完整的 Struts2 业务流学习闭环。

\n"); + out.write(" 进入 CRUD\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🧪 OGNL / 参数绑定实验

\n"); + out.write("

可视化体验普通字段、嵌套对象、多选列表是如何被 Struts2 自动绑定到 Action 的。

\n"); + out.write(" 进入实验室\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

⚠️ 验证与错误流实验

\n"); + out.write("

通过错误示例/正确示例切换,直观看到字段错误、input 返回和成功路径的区别。

\n"); + out.write(" 进入实验室\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🚀 AJAX 异步交互

\n"); + out.write("

学习Struts2如何处理AJAX请求,返回JSON数据,实现前后端分离交互。

\n"); + out.write(" AJAX演示\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

📁 文件上传

\n"); + out.write("

演示单文件、多文件上传,文件类型和大小验证,以及文件处理流程。

\n"); + out.write(" 文件上传\n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

📚 你会学到什么

\n"); + out.write("
    \n"); + out.write("
  • 请求入口:StrutsPrepareAndExecuteFilter 如何接管请求
  • \n"); + out.write("
  • 控制层:Action 如何接收参数、执行业务、返回 result
  • \n"); + out.write("
  • 视图层:JSP + Struts 标签库如何绑定 Action 数据
  • \n"); + out.write("
  • 增强机制:Interceptor Stack 如何像 AOP 一样织入日志、校验、限流
  • \n"); + out.write("
  • 状态流转:输入错误、成功提交、重定向返回列表等典型页面流
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } +} diff --git a/target/tmp/jsp/org/apache/jsp/interceptor_002ddemo_jsp.class b/target/tmp/jsp/org/apache/jsp/interceptor_002ddemo_jsp.class new file mode 100644 index 0000000..d47360a Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/interceptor_002ddemo_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/interceptor_002ddemo_jsp.java b/target/tmp/jsp/org/apache/jsp/interceptor_002ddemo_jsp.java new file mode 100644 index 0000000..88069f1 --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/interceptor_002ddemo_jsp.java @@ -0,0 +1,364 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 22:21:50 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class interceptor_002ddemo_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue; + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + } + + public void _jspDestroy() { + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.release(); + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" 拦截器演示 - Struts2\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

🛡️ Struts2 拦截器演示

\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 实验观察点:\n"); + out.write("
    \n"); + out.write("
  • 连续刷新页面,观察 Action 调用次数如何累积
  • \n"); + out.write("
  • 切换到“API 限流栈”,理解为什么拦截器顺序会影响结果
  • \n"); + out.write("
  • 注意执行时间显示,这就是拦截器注入到 request 的数据
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write("

📊 执行统计

\n"); + out.write("

本次请求执行时间: "); + if (_jspx_meth_s_005fproperty_005f0(_jspx_page_context)) + return; + out.write(" ms

\n"); + out.write(" \n"); + out.write("

Action 调用统计:

\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fiterator_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write("
Action调用次数
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write("

🔗 拦截器链演示

\n"); + out.write("

当前使用: customStack (日志 + 计时 + 监控 + 默认栈)

\n"); + out.write(" 切换到 API 限流栈\n"); + out.write(" 恢复默认栈\n"); + out.write("

API 栈包含: 日志 + 限流 + 验证 + 计时 + 默认栈

\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write("
拦截器作用你应该观察什么
LoggingInterceptor记录请求进入/退出看日志顺序,理解责任链
TimingInterceptor统计执行耗时看 executionTime 如何注入 request
MonitorInterceptor累积 Action 调用统计连续刷新看调用数增长
RateLimitInterceptor限制频率API 栈里观察限流触发
ValidationInterceptor校验输入思考错误应该在哪一层拦截
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write("

🧪 快速实验建议

\n"); + out.write("
    \n"); + out.write("
  • 先刷新当前页两次,看调用统计是否增加
  • \n"); + out.write("
  • 再切到 interceptor_api,对比多了哪些拦截器
  • \n"); + out.write("
  • 观察“先进入后退出”的洋葱模型
  • \n"); + out.write("
  • 思考:如果你要加鉴权,应放在哪个拦截器位置最合理?
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

📚 拦截器执行顺序

\n"); + out.write("
\n");
+      out.write("请求 → LoggingInterceptor → TimingInterceptor → MonitorInterceptor → Action\n");
+      out.write("响应 ← LoggingInterceptor ← TimingInterceptor ← MonitorInterceptor ← Result\n");
+      out.write("        
\n"); + out.write("

注意: 拦截器像洋葱一样,先进入的后退出

\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write("

💡 拦截器核心概念

\n"); + out.write("
    \n"); + out.write("
  • Interceptor 接口: init() → intercept() → destroy()
  • \n"); + out.write("
  • intercept() 方法: 调用 invocation.invoke() 继续链
  • \n"); + out.write("
  • 拦截器栈: 多个拦截器按顺序组成链
  • \n"); + out.write("
  • 责任链模式: 每个拦截器决定是否继续
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("

← 返回学习中心

\n"); + out.write("\n"); + out.write(""); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } + + private boolean _jspx_meth_s_005fproperty_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f0 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f0_reused = false; + try { + _jspx_th_s_005fproperty_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f0.setParent(null); + // /interceptor-demo.jsp(39,40) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f0.setValue("executionTime / 1000000.0"); + int _jspx_eval_s_005fproperty_005f0 = _jspx_th_s_005fproperty_005f0.doStartTag(); + if (_jspx_th_s_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f0); + _jspx_th_s_005fproperty_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fiterator_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:iterator + org.apache.struts2.views.jsp.IteratorTag _jspx_th_s_005fiterator_005f0 = (org.apache.struts2.views.jsp.IteratorTag) _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.get(org.apache.struts2.views.jsp.IteratorTag.class); + boolean _jspx_th_s_005fiterator_005f0_reused = false; + try { + _jspx_th_s_005fiterator_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fiterator_005f0.setParent(null); + // /interceptor-demo.jsp(44,12) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fiterator_005f0.setValue("interceptorStats"); + // /interceptor-demo.jsp(44,12) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fiterator_005f0.setVar("entry"); + int _jspx_eval_s_005fiterator_005f0 = _jspx_th_s_005fiterator_005f0.doStartTag(); + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fiterator_005f0); + } + do { + out.write("\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f1(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f2(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" \n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fiterator_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fiterator_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.reuse(_jspx_th_s_005fiterator_005f0); + _jspx_th_s_005fiterator_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fiterator_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fiterator_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f1 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f1_reused = false; + try { + _jspx_th_s_005fproperty_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /interceptor-demo.jsp(46,24) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f1.setValue("#entry.key"); + int _jspx_eval_s_005fproperty_005f1 = _jspx_th_s_005fproperty_005f1.doStartTag(); + if (_jspx_th_s_005fproperty_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f1); + _jspx_th_s_005fproperty_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f1, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f2 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f2_reused = false; + try { + _jspx_th_s_005fproperty_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /interceptor-demo.jsp(47,24) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f2.setValue("#entry.value"); + int _jspx_eval_s_005fproperty_005f2 = _jspx_th_s_005fproperty_005f2.doStartTag(); + if (_jspx_th_s_005fproperty_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f2); + _jspx_th_s_005fproperty_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f2, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f2_reused); + } + return false; + } +} diff --git a/target/tmp/jsp/org/apache/jsp/learn_jsp.class b/target/tmp/jsp/org/apache/jsp/learn_jsp.class new file mode 100644 index 0000000..d77fdd5 Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/learn_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/learn_jsp.java b/target/tmp/jsp/org/apache/jsp/learn_jsp.java new file mode 100644 index 0000000..802166e --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/learn_jsp.java @@ -0,0 +1,260 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 22:21:47 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class learn_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + } + + public void _jspDestroy() { + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" Struts2 学习中心\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

🎓 Struts2 学习中心

\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 🧪 学习任务卡\n"); + out.write("
    \n"); + out.write("
  • 先点“拦截器演示”,观察执行统计和链路顺序
  • \n"); + out.write("
  • 再点“计算器”,故意输入非法值体验 Struts2 校验
  • \n"); + out.write("
  • 最后点“用户管理”,理解 Action + JSP + 表单提交流程
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" 直接去拦截器实验\n"); + out.write(" 直接去计算器实验\n"); + out.write(" 直接去用户管理实验\n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

👋 最小闭环

\n"); + out.write("

/hello 开始,看 Action 如何返回 JSP 页面。

\n"); + out.write(" 打开 Hello\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🔢 表单与校验

\n"); + out.write("

用计算器理解参数绑定、校验失败回显、成功结果显示。

\n"); + out.write(" 打开计算器\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🛡️ 拦截器机制

\n"); + out.write("

学习 Struts2 最核心的增强机制:日志、计时、限流、监控。

\n"); + out.write(" 打开拦截器实验\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

👥 CRUD 业务流

\n"); + out.write("

通过用户管理体验列表页、表单页、重定向和状态更新。

\n"); + out.write(" 打开用户管理\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🧪 OGNL / 参数绑定实验

\n"); + out.write("

通过真正可交互的表单观察 Struts2 的字段绑定、嵌套对象绑定和集合绑定。

\n"); + out.write(" 打开 OGNL 实验室\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

⚠️ 验证与错误流实验

\n"); + out.write("

学习为什么校验失败不会直接 500,而是回到 input 页面并显示字段级错误。

\n"); + out.write(" 打开验证实验室\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

🚀 AJAX 异步交互

\n"); + out.write("

学习Struts2如何处理AJAX请求,返回JSON数据,实现无刷新交互和实时数据更新。

\n"); + out.write(" 打开AJAX演示\n"); + out.write("
\n"); + out.write("
\n"); + out.write("

📁 文件上传

\n"); + out.write("

演示单文件和多文件上传,学习文件类型验证、大小限制和文件处理流程。

\n"); + out.write(" 打开文件上传\n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("

📚 学习路径

\n"); + out.write("
\n"); + out.write("

1. MVC 架构

\n"); + out.write("
    \n"); + out.write("
  • Model: Action 类 + JavaBean
  • \n"); + out.write("
  • View: JSP + Struts 标签库
  • \n"); + out.write("
  • Controller: StrutsPrepareAndExecuteFilter
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

2. 拦截器机制

\n"); + out.write("
    \n"); + out.write("
  • Interceptor 接口: init() → intercept() → destroy()
  • \n"); + out.write("
  • interceptor-stack: 组合多个拦截器
  • \n"); + out.write("
  • 执行顺序: 责任链模式(先入后出)
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

3. OGNL 与标签库

\n"); + out.write("
    \n"); + out.write("
  • <s:property value=\"name\"/> - 输出属性
  • \n"); + out.write("
  • <s:iterator value=\"list\"> - 遍历集合
  • \n"); + out.write("
  • <s:form> + <s:textfield> - 表单绑定
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

4. 你当前项目里有哪些实验

\n"); + out.write("
    \n"); + out.write("
  • Hello:最小 Action/JSP 映射
  • \n"); + out.write("
  • Calculator:参数绑定 + 校验 + 错误回显
  • \n"); + out.write("
  • Interceptor:理解自定义拦截器与请求链
  • \n"); + out.write("
  • User CRUD:模拟真实业务增删改查
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("

← 返回首页

\n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } +} diff --git a/target/tmp/jsp/org/apache/jsp/ognl_002dlab_jsp.class b/target/tmp/jsp/org/apache/jsp/ognl_002dlab_jsp.class new file mode 100644 index 0000000..6893ff8 Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/ognl_002dlab_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/ognl_002dlab_jsp.java b/target/tmp/jsp/org/apache/jsp/ognl_002dlab_jsp.java new file mode 100644 index 0000000..da63448 --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/ognl_002dlab_jsp.java @@ -0,0 +1,642 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 22:21:44 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class ognl_002dlab_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fcheckboxlist_0026_005fname_005flist_005flabel_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody; + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fcheckboxlist_0026_005fname_005flist_005flabel_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + } + + public void _jspDestroy() { + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.release(); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fcheckboxlist_0026_005fname_005flist_005flabel_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.release(); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.release(); + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" OGNL / 参数绑定实验室 - Struts2\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

🧪 OGNL / 参数绑定实验室

\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 实验任务卡\n"); + out.write("
    \n"); + out.write("
  • 输入关键字和最小年龄,观察 Struts2 如何自动绑定请求参数到 Action 字段
  • \n"); + out.write("
  • 注意 keywordminAgeuser.name 这类命名会如何映射
  • \n"); + out.write("
  • 观察页面里 <s:property><s:iterator> 如何读取 Action 中的数据
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

参数过滤实验

\n"); + out.write(" "); + if (_jspx_meth_s_005fform_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

绑定结果观察

\n"); + out.write("

keyword = "); + if (_jspx_meth_s_005fproperty_005f0(_jspx_page_context)) + return; + out.write("

\n"); + out.write("

minAge = "); + if (_jspx_meth_s_005fproperty_005f1(_jspx_page_context)) + return; + out.write("

\n"); + out.write("

user.name = "); + if (_jspx_meth_s_005fproperty_005f2(_jspx_page_context)) + return; + out.write("

\n"); + out.write("

tags = "); + if (_jspx_meth_s_005fproperty_005f3(_jspx_page_context)) + return; + out.write("

\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

过滤后的用户列表

\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fiterator_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write("
姓名邮箱年龄
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

学习点

\n"); + out.write("
    \n"); + out.write("
  • keyword → 直接绑定到 Action 同名字段
  • \n"); + out.write("
  • user.name → 绑定到嵌套对象属性
  • \n"); + out.write("
  • tags → 多选值绑定到 List<String>
  • \n"); + out.write("
  • <s:iterator> 会遍历 Action 暴露出来的集合
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("

← 返回学习中心

\n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } + + private boolean _jspx_meth_s_005fform_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:form + org.apache.struts2.views.jsp.ui.FormTag _jspx_th_s_005fform_005f0 = (org.apache.struts2.views.jsp.ui.FormTag) _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.get(org.apache.struts2.views.jsp.ui.FormTag.class); + boolean _jspx_th_s_005fform_005f0_reused = false; + try { + _jspx_th_s_005fform_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fform_005f0.setParent(null); + // /ognl-lab.jsp(36,8) name = action type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setAction("ognl_bind"); + // /ognl-lab.jsp(36,8) name = method type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setMethod("post"); + int _jspx_eval_s_005fform_005f0 = _jspx_th_s_005fform_005f0.doStartTag(); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fform_005f0); + } + do { + out.write("\n"); + out.write("
\n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write("
\n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f2(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fcheckboxlist_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fform_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.reuse(_jspx_th_s_005fform_005f0); + _jspx_th_s_005fform_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fform_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fform_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f0 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f0_reused = false; + try { + _jspx_th_s_005ftextfield_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /ognl-lab.jsp(38,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f0.setName("keyword"); + // /ognl-lab.jsp(38,16) name = label type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f0.setLabel("关键字"); + // /ognl-lab.jsp(38,16) null + _jspx_th_s_005ftextfield_005f0.setDynamicAttribute(null, "placeholder", "例如:张 / example"); + int _jspx_eval_s_005ftextfield_005f0 = _jspx_th_s_005ftextfield_005f0.doStartTag(); + if (_jspx_th_s_005ftextfield_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.reuse(_jspx_th_s_005ftextfield_005f0); + _jspx_th_s_005ftextfield_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f1 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f1_reused = false; + try { + _jspx_th_s_005ftextfield_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /ognl-lab.jsp(39,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f1.setName("minAge"); + // /ognl-lab.jsp(39,16) name = label type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f1.setLabel("最小年龄"); + // /ognl-lab.jsp(39,16) null + _jspx_th_s_005ftextfield_005f1.setDynamicAttribute(null, "placeholder", "例如:20"); + int _jspx_eval_s_005ftextfield_005f1 = _jspx_th_s_005ftextfield_005f1.doStartTag(); + if (_jspx_th_s_005ftextfield_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.reuse(_jspx_th_s_005ftextfield_005f1); + _jspx_th_s_005ftextfield_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f2 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f2_reused = false; + try { + _jspx_th_s_005ftextfield_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /ognl-lab.jsp(42,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f2.setName("user.name"); + // /ognl-lab.jsp(42,16) name = label type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f2.setLabel("嵌套对象 user.name"); + // /ognl-lab.jsp(42,16) null + _jspx_th_s_005ftextfield_005f2.setDynamicAttribute(null, "placeholder", "例如:测试用户"); + int _jspx_eval_s_005ftextfield_005f2 = _jspx_th_s_005ftextfield_005f2.doStartTag(); + if (_jspx_th_s_005ftextfield_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005flabel_005fnobody.reuse(_jspx_th_s_005ftextfield_005f2); + _jspx_th_s_005ftextfield_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f2, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f2_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fcheckboxlist_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:checkboxlist + org.apache.struts2.views.jsp.ui.CheckboxListTag _jspx_th_s_005fcheckboxlist_005f0 = (org.apache.struts2.views.jsp.ui.CheckboxListTag) _005fjspx_005ftagPool_005fs_005fcheckboxlist_0026_005fname_005flist_005flabel_005fnobody.get(org.apache.struts2.views.jsp.ui.CheckboxListTag.class); + boolean _jspx_th_s_005fcheckboxlist_005f0_reused = false; + try { + _jspx_th_s_005fcheckboxlist_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fcheckboxlist_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /ognl-lab.jsp(43,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fcheckboxlist_005f0.setName("tags"); + // /ognl-lab.jsp(43,16) name = label type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fcheckboxlist_005f0.setLabel("兴趣标签"); + // /ognl-lab.jsp(43,16) name = list type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fcheckboxlist_005f0.setList("{'MVC','OGNL','Interceptor','JSP'}"); + int _jspx_eval_s_005fcheckboxlist_005f0 = _jspx_th_s_005fcheckboxlist_005f0.doStartTag(); + if (_jspx_th_s_005fcheckboxlist_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fcheckboxlist_0026_005fname_005flist_005flabel_005fnobody.reuse(_jspx_th_s_005fcheckboxlist_005f0); + _jspx_th_s_005fcheckboxlist_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fcheckboxlist_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fcheckboxlist_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f0 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f0_reused = false; + try { + _jspx_th_s_005fproperty_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f0.setParent(null); + // /ognl-lab.jsp(51,27) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f0.setValue("keyword"); + // /ognl-lab.jsp(51,27) name = default type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f0.setDefault("(空)"); + int _jspx_eval_s_005fproperty_005f0 = _jspx_th_s_005fproperty_005f0.doStartTag(); + if (_jspx_th_s_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.reuse(_jspx_th_s_005fproperty_005f0); + _jspx_th_s_005fproperty_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f1(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f1 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f1_reused = false; + try { + _jspx_th_s_005fproperty_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f1.setParent(null); + // /ognl-lab.jsp(52,26) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f1.setValue("minAge"); + // /ognl-lab.jsp(52,26) name = default type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f1.setDefault("(空)"); + int _jspx_eval_s_005fproperty_005f1 = _jspx_th_s_005fproperty_005f1.doStartTag(); + if (_jspx_th_s_005fproperty_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.reuse(_jspx_th_s_005fproperty_005f1); + _jspx_th_s_005fproperty_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f1, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f2(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f2 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f2_reused = false; + try { + _jspx_th_s_005fproperty_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f2.setParent(null); + // /ognl-lab.jsp(53,29) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f2.setValue("user.name"); + // /ognl-lab.jsp(53,29) name = default type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f2.setDefault("(空)"); + int _jspx_eval_s_005fproperty_005f2 = _jspx_th_s_005fproperty_005f2.doStartTag(); + if (_jspx_th_s_005fproperty_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.reuse(_jspx_th_s_005fproperty_005f2); + _jspx_th_s_005fproperty_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f2, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f2_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f3(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f3 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f3_reused = false; + try { + _jspx_th_s_005fproperty_005f3.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f3.setParent(null); + // /ognl-lab.jsp(54,24) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f3.setValue("tags"); + // /ognl-lab.jsp(54,24) name = default type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f3.setDefault("[]"); + int _jspx_eval_s_005fproperty_005f3 = _jspx_th_s_005fproperty_005f3.doStartTag(); + if (_jspx_th_s_005fproperty_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fdefault_005fnobody.reuse(_jspx_th_s_005fproperty_005f3); + _jspx_th_s_005fproperty_005f3_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f3, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f3_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fiterator_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:iterator + org.apache.struts2.views.jsp.IteratorTag _jspx_th_s_005fiterator_005f0 = (org.apache.struts2.views.jsp.IteratorTag) _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.get(org.apache.struts2.views.jsp.IteratorTag.class); + boolean _jspx_th_s_005fiterator_005f0_reused = false; + try { + _jspx_th_s_005fiterator_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fiterator_005f0.setParent(null); + // /ognl-lab.jsp(61,12) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fiterator_005f0.setValue("filteredUsers"); + // /ognl-lab.jsp(61,12) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fiterator_005f0.setVar("u"); + int _jspx_eval_s_005fiterator_005f0 = _jspx_th_s_005fiterator_005f0.doStartTag(); + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fiterator_005f0); + } + do { + out.write("\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f4(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f5(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f6(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" \n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fiterator_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fiterator_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.reuse(_jspx_th_s_005fiterator_005f0); + _jspx_th_s_005fiterator_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fiterator_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fiterator_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f4 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f4_reused = false; + try { + _jspx_th_s_005fproperty_005f4.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /ognl-lab.jsp(63,24) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f4.setValue("#u.name"); + int _jspx_eval_s_005fproperty_005f4 = _jspx_th_s_005fproperty_005f4.doStartTag(); + if (_jspx_th_s_005fproperty_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f4); + _jspx_th_s_005fproperty_005f4_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f4, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f4_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f5 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f5_reused = false; + try { + _jspx_th_s_005fproperty_005f5.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /ognl-lab.jsp(64,24) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f5.setValue("#u.email"); + int _jspx_eval_s_005fproperty_005f5 = _jspx_th_s_005fproperty_005f5.doStartTag(); + if (_jspx_th_s_005fproperty_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f5); + _jspx_th_s_005fproperty_005f5_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f5, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f5_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f6 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f6_reused = false; + try { + _jspx_th_s_005fproperty_005f6.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /ognl-lab.jsp(65,24) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f6.setValue("#u.age"); + int _jspx_eval_s_005fproperty_005f6 = _jspx_th_s_005fproperty_005f6.doStartTag(); + if (_jspx_th_s_005fproperty_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f6); + _jspx_th_s_005fproperty_005f6_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f6, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f6_reused); + } + return false; + } +} diff --git a/target/tmp/jsp/org/apache/jsp/user_002dform_jsp.class b/target/tmp/jsp/org/apache/jsp/user_002dform_jsp.class new file mode 100644 index 0000000..476821e Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/user_002dform_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/user_002dform_jsp.java b/target/tmp/jsp/org/apache/jsp/user_002dform_jsp.java new file mode 100644 index 0000000..970e26a --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/user_002dform_jsp.java @@ -0,0 +1,561 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 22:22:06 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class user_002dform_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fif_0026_005ftest; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005felse; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fhidden_0026_005fname_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody; + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005felse = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fhidden_0026_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + } + + public void _jspDestroy() { + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.release(); + _005fjspx_005ftagPool_005fs_005felse.release(); + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.release(); + _005fjspx_005ftagPool_005fs_005fhidden_0026_005fname_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.release(); + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" 用户表单 - Struts2\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

"); + if (_jspx_meth_s_005fif_005f0(_jspx_page_context)) + return; + if (_jspx_meth_s_005felse_005f0(_jspx_page_context)) + return; + out.write("

\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 实验任务卡\n"); + out.write("
    \n"); + out.write("
  • 试着新增一个完整用户,提交后观察为什么回到列表页
  • \n"); + out.write("
  • 再故意填一个不合理年龄,看当前脚手架是否已经做服务端校验
  • \n"); + out.write("
  • 思考:如果要做更严谨校验,你会把规则放在 Action、拦截器,还是 XML/注解里?
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 快速填充示例\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fform_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" 学习点\n"); + out.write("
    \n"); + out.write("
  • 表单字段名 user.name / user.email / user.age 会映射到嵌套对象
  • \n"); + out.write("
  • 当进入编辑页时,Action 会先根据 id 找到已有对象并回填
  • \n"); + out.write("
  • 提交成功后通过 redirectAction 返回列表页,避免刷新重复提交
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("

← 返回用户列表

\n"); + out.write("\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } + + private boolean _jspx_meth_s_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:if + org.apache.struts2.views.jsp.IfTag _jspx_th_s_005fif_005f0 = (org.apache.struts2.views.jsp.IfTag) _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.get(org.apache.struts2.views.jsp.IfTag.class); + boolean _jspx_th_s_005fif_005f0_reused = false; + try { + _jspx_th_s_005fif_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fif_005f0.setParent(null); + // /user-form.jsp(23,8) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fif_005f0.setTest("user.id == null"); + int _jspx_eval_s_005fif_005f0 = _jspx_th_s_005fif_005f0.doStartTag(); + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fif_005f0); + } + do { + out.write("添加用户"); + int evalDoAfterBody = _jspx_th_s_005fif_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.reuse(_jspx_th_s_005fif_005f0); + _jspx_th_s_005fif_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fif_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fif_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005felse_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:else + org.apache.struts2.views.jsp.ElseTag _jspx_th_s_005felse_005f0 = (org.apache.struts2.views.jsp.ElseTag) _005fjspx_005ftagPool_005fs_005felse.get(org.apache.struts2.views.jsp.ElseTag.class); + boolean _jspx_th_s_005felse_005f0_reused = false; + try { + _jspx_th_s_005felse_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005felse_005f0.setParent(null); + int _jspx_eval_s_005felse_005f0 = _jspx_th_s_005felse_005f0.doStartTag(); + if (_jspx_eval_s_005felse_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005felse_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005felse_005f0); + } + do { + out.write("编辑用户"); + int evalDoAfterBody = _jspx_th_s_005felse_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005felse_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005felse_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005felse.reuse(_jspx_th_s_005felse_005f0); + _jspx_th_s_005felse_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005felse_005f0, _jsp_getInstanceManager(), _jspx_th_s_005felse_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fform_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:form + org.apache.struts2.views.jsp.ui.FormTag _jspx_th_s_005fform_005f0 = (org.apache.struts2.views.jsp.ui.FormTag) _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.get(org.apache.struts2.views.jsp.ui.FormTag.class); + boolean _jspx_th_s_005fform_005f0_reused = false; + try { + _jspx_th_s_005fform_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fform_005f0.setParent(null); + // /user-form.jsp(42,4) name = action type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setAction("%{user.id == null ? 'user_add' : 'user_update'}"); + // /user-form.jsp(42,4) name = method type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setMethod("post"); + int _jspx_eval_s_005fform_005f0 = _jspx_th_s_005fform_005f0.doStartTag(); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fform_005f0); + } + do { + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fhidden_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f2(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f2(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fform_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.reuse(_jspx_th_s_005fform_005f0); + _jspx_th_s_005fform_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fform_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fform_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fhidden_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:hidden + org.apache.struts2.views.jsp.ui.HiddenTag _jspx_th_s_005fhidden_005f0 = (org.apache.struts2.views.jsp.ui.HiddenTag) _005fjspx_005ftagPool_005fs_005fhidden_0026_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.HiddenTag.class); + boolean _jspx_th_s_005fhidden_005f0_reused = false; + try { + _jspx_th_s_005fhidden_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fhidden_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(43,8) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fhidden_005f0.setName("user.id"); + int _jspx_eval_s_005fhidden_005f0 = _jspx_th_s_005fhidden_005f0.doStartTag(); + if (_jspx_th_s_005fhidden_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fhidden_0026_005fname_005fnobody.reuse(_jspx_th_s_005fhidden_005f0); + _jspx_th_s_005fhidden_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fhidden_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fhidden_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f0 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f0_reused = false; + try { + _jspx_th_s_005ftextfield_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(47,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f0.setName("user.name"); + // /user-form.jsp(47,12) null + _jspx_th_s_005ftextfield_005f0.setDynamicAttribute(null, "placeholder", "请输入姓名"); + int _jspx_eval_s_005ftextfield_005f0 = _jspx_th_s_005ftextfield_005f0.doStartTag(); + if (_jspx_th_s_005ftextfield_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f0); + _jspx_th_s_005ftextfield_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f0 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f0_reused = false; + try { + _jspx_th_s_005ffielderror_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(48,12) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f0.setFieldName("user.name"); + // /user-form.jsp(48,12) name = cssStyle type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f0.setCssStyle("color:#e74c3c;font-size:12px;"); + int _jspx_eval_s_005ffielderror_005f0 = _jspx_th_s_005ffielderror_005f0.doStartTag(); + if (_jspx_th_s_005ffielderror_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.reuse(_jspx_th_s_005ffielderror_005f0); + _jspx_th_s_005ffielderror_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f1 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f1_reused = false; + try { + _jspx_th_s_005ftextfield_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(53,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f1.setName("user.email"); + // /user-form.jsp(53,12) null + _jspx_th_s_005ftextfield_005f1.setDynamicAttribute(null, "placeholder", "请输入邮箱"); + int _jspx_eval_s_005ftextfield_005f1 = _jspx_th_s_005ftextfield_005f1.doStartTag(); + if (_jspx_th_s_005ftextfield_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f1); + _jspx_th_s_005ftextfield_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f1 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f1_reused = false; + try { + _jspx_th_s_005ffielderror_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(54,12) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f1.setFieldName("user.email"); + // /user-form.jsp(54,12) name = cssStyle type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f1.setCssStyle("color:#e74c3c;font-size:12px;"); + int _jspx_eval_s_005ffielderror_005f1 = _jspx_th_s_005ffielderror_005f1.doStartTag(); + if (_jspx_th_s_005ffielderror_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.reuse(_jspx_th_s_005ffielderror_005f1); + _jspx_th_s_005ffielderror_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f2 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f2_reused = false; + try { + _jspx_th_s_005ftextfield_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(59,12) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f2.setName("user.age"); + // /user-form.jsp(59,12) null + _jspx_th_s_005ftextfield_005f2.setDynamicAttribute(null, "placeholder", "请输入年龄"); + int _jspx_eval_s_005ftextfield_005f2 = _jspx_th_s_005ftextfield_005f2.doStartTag(); + if (_jspx_th_s_005ftextfield_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fplaceholder_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f2); + _jspx_th_s_005ftextfield_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f2, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f2_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f2 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f2_reused = false; + try { + _jspx_th_s_005ffielderror_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /user-form.jsp(60,12) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f2.setFieldName("user.age"); + // /user-form.jsp(60,12) name = cssStyle type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f2.setCssStyle("color:#e74c3c;font-size:12px;"); + int _jspx_eval_s_005ffielderror_005f2 = _jspx_th_s_005ffielderror_005f2.doStartTag(); + if (_jspx_th_s_005ffielderror_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.reuse(_jspx_th_s_005ffielderror_005f2); + _jspx_th_s_005ffielderror_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f2, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f2_reused); + } + return false; + } +} diff --git a/target/tmp/jsp/org/apache/jsp/user_002dlist_jsp.class b/target/tmp/jsp/org/apache/jsp/user_002dlist_jsp.class new file mode 100644 index 0000000..9ac1d73 Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/user_002dlist_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/user_002dlist_jsp.java b/target/tmp/jsp/org/apache/jsp/user_002dlist_jsp.java new file mode 100644 index 0000000..ed67b41 --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/user_002dlist_jsp.java @@ -0,0 +1,453 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 11:40:06 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class user_002dlist_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue; + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + } + + public void _jspDestroy() { + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.release(); + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" 用户管理 - Struts2 CRUD 示例\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

👥 用户管理 - Struts2 CRUD 示例

\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 实验任务卡\n"); + out.write("
    \n"); + out.write("
  • 先新增一个用户,观察表单提交后为什么会回到列表页
  • \n"); + out.write("
  • 再编辑一个用户,体会 Struts2 如何把已有数据回填到表单
  • \n"); + out.write("
  • 最后删除一个用户,理解 redirectAction 的使用场景
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("
当前用户数"); + if (_jspx_meth_s_005fproperty_005f0(_jspx_page_context)) + return; + out.write("
\n"); + out.write("
演示模式内存列表
\n"); + out.write("
学习重点CRUD 流程
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("

+ 添加用户

\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fiterator_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write("
ID姓名邮箱年龄操作
\n"); + out.write(" \n"); + out.write("
\n"); + out.write(" 学习点\n"); + out.write("
    \n"); + out.write("
  • <s:iterator> 遍历集合
  • \n"); + out.write("
  • redirectAction 结果类型实现 PRG 模式
  • \n"); + out.write("
  • 同一个 Action 通过不同 method 处理 list/add/edit/update/delete
  • \n"); + out.write("
  • 这里的数据存在内存里,重启后会恢复初始样本
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write("

← 返回学习中心

\n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } + + private boolean _jspx_meth_s_005fproperty_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f0 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f0_reused = false; + try { + _jspx_th_s_005fproperty_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f0.setParent(null); + // /user-list.jsp(40,52) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f0.setValue("userList.size()"); + int _jspx_eval_s_005fproperty_005f0 = _jspx_th_s_005fproperty_005f0.doStartTag(); + if (_jspx_th_s_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f0); + _jspx_th_s_005fproperty_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fiterator_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:iterator + org.apache.struts2.views.jsp.IteratorTag _jspx_th_s_005fiterator_005f0 = (org.apache.struts2.views.jsp.IteratorTag) _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.get(org.apache.struts2.views.jsp.IteratorTag.class); + boolean _jspx_th_s_005fiterator_005f0_reused = false; + try { + _jspx_th_s_005fiterator_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fiterator_005f0.setParent(null); + // /user-list.jsp(55,8) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fiterator_005f0.setValue("userList"); + // /user-list.jsp(55,8) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fiterator_005f0.setVar("u"); + int _jspx_eval_s_005fiterator_005f0 = _jspx_th_s_005fiterator_005f0.doStartTag(); + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fiterator_005f0); + } + do { + out.write("\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f1(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f2(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f3(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fproperty_005f4(_jspx_th_s_005fiterator_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" \n"); + out.write(" 编辑\n"); + out.write(" 删除\n"); + out.write(" \n"); + out.write(" \n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fiterator_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fiterator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fiterator_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fiterator_0026_005fvar_005fvalue.reuse(_jspx_th_s_005fiterator_005f0); + _jspx_th_s_005fiterator_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fiterator_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fiterator_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f1 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f1_reused = false; + try { + _jspx_th_s_005fproperty_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /user-list.jsp(57,20) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f1.setValue("#u.id"); + int _jspx_eval_s_005fproperty_005f1 = _jspx_th_s_005fproperty_005f1.doStartTag(); + if (_jspx_th_s_005fproperty_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f1); + _jspx_th_s_005fproperty_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f1, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f2 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f2_reused = false; + try { + _jspx_th_s_005fproperty_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /user-list.jsp(58,20) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f2.setValue("#u.name"); + int _jspx_eval_s_005fproperty_005f2 = _jspx_th_s_005fproperty_005f2.doStartTag(); + if (_jspx_th_s_005fproperty_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f2); + _jspx_th_s_005fproperty_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f2, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f2_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f3 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f3_reused = false; + try { + _jspx_th_s_005fproperty_005f3.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /user-list.jsp(59,20) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f3.setValue("#u.email"); + int _jspx_eval_s_005fproperty_005f3 = _jspx_th_s_005fproperty_005f3.doStartTag(); + if (_jspx_th_s_005fproperty_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f3); + _jspx_th_s_005fproperty_005f3_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f3, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f3_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f4 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f4_reused = false; + try { + _jspx_th_s_005fproperty_005f4.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /user-list.jsp(60,20) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f4.setValue("#u.age"); + int _jspx_eval_s_005fproperty_005f4 = _jspx_th_s_005fproperty_005f4.doStartTag(); + if (_jspx_th_s_005fproperty_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f4); + _jspx_th_s_005fproperty_005f4_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f4, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f4_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f5 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f5_reused = false; + try { + _jspx_th_s_005fproperty_005f5.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /user-list.jsp(62,63) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f5.setValue("#u.id"); + int _jspx_eval_s_005fproperty_005f5 = _jspx_th_s_005fproperty_005f5.doStartTag(); + if (_jspx_th_s_005fproperty_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f5); + _jspx_th_s_005fproperty_005f5_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f5, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f5_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fiterator_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f6 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f6_reused = false; + try { + _jspx_th_s_005fproperty_005f6.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fiterator_005f0); + // /user-list.jsp(63,67) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f6.setValue("#u.id"); + int _jspx_eval_s_005fproperty_005f6 = _jspx_th_s_005fproperty_005f6.doStartTag(); + if (_jspx_th_s_005fproperty_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f6); + _jspx_th_s_005fproperty_005f6_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f6, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f6_reused); + } + return false; + } +} diff --git a/target/tmp/jsp/org/apache/jsp/validation_002dlab_jsp.class b/target/tmp/jsp/org/apache/jsp/validation_002dlab_jsp.class new file mode 100644 index 0000000..be2cd73 Binary files /dev/null and b/target/tmp/jsp/org/apache/jsp/validation_002dlab_jsp.class differ diff --git a/target/tmp/jsp/org/apache/jsp/validation_002dlab_jsp.java b/target/tmp/jsp/org/apache/jsp/validation_002dlab_jsp.java new file mode 100644 index 0000000..4cc87b2 --- /dev/null +++ b/target/tmp/jsp/org/apache/jsp/validation_002dlab_jsp.java @@ -0,0 +1,514 @@ +/* + * Generated by the Jasper component of Apache Tomcat + * Version: jetty/9.4.54.v20240208 + * Generated at: 2026-03-12 22:22:01 UTC + * Note: The last modified time of this file was set to + * the last modified time of the source file after + * generation to assist with modification tracking. + */ +package org.apache.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.jsp.*; + +public final class validation_002dlab_jsp extends org.apache.jasper.runtime.HttpJspBase + implements org.apache.jasper.runtime.JspSourceDependent, + org.apache.jasper.runtime.JspSourceImports { + + private static final javax.servlet.jsp.JspFactory _jspxFactory = + javax.servlet.jsp.JspFactory.getDefaultFactory(); + + private static java.util.Map _jspx_dependants; + + static { + _jspx_dependants = new java.util.HashMap(2); + _jspx_dependants.put("file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar", Long.valueOf(1772603570859L)); + _jspx_dependants.put("jar:file:/home/llm/.m2/repository/org/apache/struts/struts2-core/6.4.0/struts2-core-6.4.0.jar!/META-INF/struts-tags.tld", Long.valueOf(1712452520000L)); + } + + private static final java.util.Set _jspx_imports_packages; + + private static final java.util.Set _jspx_imports_classes; + + static { + _jspx_imports_packages = new java.util.HashSet<>(); + _jspx_imports_packages.add("javax.servlet"); + _jspx_imports_packages.add("javax.servlet.http"); + _jspx_imports_packages.add("javax.servlet.jsp"); + _jspx_imports_classes = null; + } + + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fif_0026_005ftest; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody; + private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody; + + private volatile javax.el.ExpressionFactory _el_expressionfactory; + private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; + + public java.util.Map getDependants() { + return _jspx_dependants; + } + + public java.util.Set getPackageImports() { + return _jspx_imports_packages; + } + + public java.util.Set getClassImports() { + return _jspx_imports_classes; + } + + public javax.el.ExpressionFactory _jsp_getExpressionFactory() { + if (_el_expressionfactory == null) { + synchronized (this) { + if (_el_expressionfactory == null) { + _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); + } + } + } + return _el_expressionfactory; + } + + public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { + if (_jsp_instancemanager == null) { + synchronized (this) { + if (_jsp_instancemanager == null) { + _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); + } + } + } + return _jsp_instancemanager; + } + + public void _jspInit() { + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); + } + + public void _jspDestroy() { + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.release(); + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.release(); + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.release(); + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.release(); + } + + public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) + throws java.io.IOException, javax.servlet.ServletException { + + final java.lang.String _jspx_method = request.getMethod(); + if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS"); + return; + } + + final javax.servlet.jsp.PageContext pageContext; + javax.servlet.http.HttpSession session = null; + final javax.servlet.ServletContext application; + final javax.servlet.ServletConfig config; + javax.servlet.jsp.JspWriter out = null; + final java.lang.Object page = this; + javax.servlet.jsp.JspWriter _jspx_out = null; + javax.servlet.jsp.PageContext _jspx_page_context = null; + + + try { + response.setContentType("text/html;charset=UTF-8"); + pageContext = _jspxFactory.getPageContext(this, request, response, + null, true, 8192, true); + _jspx_page_context = pageContext; + application = pageContext.getServletContext(); + config = pageContext.getServletConfig(); + session = pageContext.getSession(); + out = pageContext.getOut(); + _jspx_out = out; + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(" \n"); + out.write(" 验证与错误流实验室 - Struts2\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + out.write("

⚠️ 验证与错误流实验室

\n"); + out.write("\n"); + out.write("
\n"); + out.write(" 实验任务卡\n"); + out.write("
    \n"); + out.write("
  • 先点“填入错误示例”,提交后观察字段级错误是如何显示的
  • \n"); + out.write("
  • 再点“填入正确示例”,观察 Action 成功后的返回
  • \n"); + out.write("
  • 思考:为什么 Struts2 的校验失败会回到 input 页,而不是直接报 500?
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" \n"); + out.write("
\n"); + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fif_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005fform_005f0(_jspx_page_context)) + return; + out.write("\n"); + out.write("
\n"); + out.write("\n"); + out.write("
\n"); + out.write("

学习点

\n"); + out.write("
    \n"); + out.write("
  • 字段错误通过 addFieldError() 收集
  • \n"); + out.write("
  • JSP 使用 <s:fielderror> 精准展示错误
  • \n"); + out.write("
  • 成功路径与失败路径在同一个页面闭环,对学习最直观
  • \n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("

← 返回学习中心

\n"); + out.write("\n"); + out.write(" \n"); + out.write("\n"); + out.write("\n"); + } catch (java.lang.Throwable t) { + if (!(t instanceof javax.servlet.jsp.SkipPageException)){ + out = _jspx_out; + if (out != null && out.getBufferSize() != 0) + try { + if (response.isCommitted()) { + out.flush(); + } else { + out.clearBuffer(); + } + } catch (java.io.IOException e) {} + if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); + else throw new ServletException(t); + } + } finally { + _jspxFactory.releasePageContext(_jspx_page_context); + } + } + + private boolean _jspx_meth_s_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:if + org.apache.struts2.views.jsp.IfTag _jspx_th_s_005fif_005f0 = (org.apache.struts2.views.jsp.IfTag) _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.get(org.apache.struts2.views.jsp.IfTag.class); + boolean _jspx_th_s_005fif_005f0_reused = false; + try { + _jspx_th_s_005fif_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fif_005f0.setParent(null); + // /validation-lab.jsp(38,8) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fif_005f0.setTest("resultMessage != null"); + int _jspx_eval_s_005fif_005f0 = _jspx_th_s_005fif_005f0.doStartTag(); + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fif_005f0); + } + do { + out.write("\n"); + out.write("
"); + if (_jspx_meth_s_005fproperty_005f0(_jspx_th_s_005fif_005f0, _jspx_page_context)) + return true; + out.write("
\n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fif_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fif_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fif_0026_005ftest.reuse(_jspx_th_s_005fif_005f0); + _jspx_th_s_005fif_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fif_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fif_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fproperty_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:property + org.apache.struts2.views.jsp.PropertyTag _jspx_th_s_005fproperty_005f0 = (org.apache.struts2.views.jsp.PropertyTag) _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.get(org.apache.struts2.views.jsp.PropertyTag.class); + boolean _jspx_th_s_005fproperty_005f0_reused = false; + try { + _jspx_th_s_005fproperty_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fproperty_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fif_005f0); + // /validation-lab.jsp(39,28) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fproperty_005f0.setValue("resultMessage"); + int _jspx_eval_s_005fproperty_005f0 = _jspx_th_s_005fproperty_005f0.doStartTag(); + if (_jspx_th_s_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_s_005fproperty_005f0); + _jspx_th_s_005fproperty_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fproperty_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fproperty_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005fform_005f0(javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:form + org.apache.struts2.views.jsp.ui.FormTag _jspx_th_s_005fform_005f0 = (org.apache.struts2.views.jsp.ui.FormTag) _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.get(org.apache.struts2.views.jsp.ui.FormTag.class); + boolean _jspx_th_s_005fform_005f0_reused = false; + try { + _jspx_th_s_005fform_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005fform_005f0.setParent(null); + // /validation-lab.jsp(42,8) name = action type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setAction("validation_submit"); + // /validation-lab.jsp(42,8) name = method type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005fform_005f0.setMethod("post"); + int _jspx_eval_s_005fform_005f0 = _jspx_th_s_005fform_005f0.doStartTag(); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = org.apache.jasper.runtime.JspRuntimeLibrary.startBufferedBody(_jspx_page_context, _jspx_th_s_005fform_005f0); + } + do { + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f0(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f1(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + if (_jspx_meth_s_005ftextfield_005f2(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write(" "); + if (_jspx_meth_s_005ffielderror_005f2(_jspx_th_s_005fform_005f0, _jspx_page_context)) + return true; + out.write("\n"); + out.write("
\n"); + out.write(" \n"); + out.write(" "); + int evalDoAfterBody = _jspx_th_s_005fform_005f0.doAfterBody(); + if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) + break; + } while (true); + if (_jspx_eval_s_005fform_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { + out = _jspx_page_context.popBody(); + } + } + if (_jspx_th_s_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005fform_0026_005fmethod_005faction.reuse(_jspx_th_s_005fform_005f0); + _jspx_th_s_005fform_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005fform_005f0, _jsp_getInstanceManager(), _jspx_th_s_005fform_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f0 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f0_reused = false; + try { + _jspx_th_s_005ftextfield_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /validation-lab.jsp(45,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f0.setName("username"); + int _jspx_eval_s_005ftextfield_005f0 = _jspx_th_s_005ftextfield_005f0.doStartTag(); + if (_jspx_th_s_005ftextfield_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f0); + _jspx_th_s_005ftextfield_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f0 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f0_reused = false; + try { + _jspx_th_s_005ffielderror_005f0.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /validation-lab.jsp(46,16) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f0.setFieldName("username"); + // /validation-lab.jsp(46,16) name = cssStyle type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f0.setCssStyle("color:#e74c3c;font-size:12px;"); + int _jspx_eval_s_005ffielderror_005f0 = _jspx_th_s_005ffielderror_005f0.doStartTag(); + if (_jspx_th_s_005ffielderror_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.reuse(_jspx_th_s_005ffielderror_005f0); + _jspx_th_s_005ffielderror_005f0_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f0, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f0_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f1 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f1_reused = false; + try { + _jspx_th_s_005ftextfield_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /validation-lab.jsp(50,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f1.setName("email"); + int _jspx_eval_s_005ftextfield_005f1 = _jspx_th_s_005ftextfield_005f1.doStartTag(); + if (_jspx_th_s_005ftextfield_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f1); + _jspx_th_s_005ftextfield_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f1 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f1_reused = false; + try { + _jspx_th_s_005ffielderror_005f1.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /validation-lab.jsp(51,16) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f1.setFieldName("email"); + // /validation-lab.jsp(51,16) name = cssStyle type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f1.setCssStyle("color:#e74c3c;font-size:12px;"); + int _jspx_eval_s_005ffielderror_005f1 = _jspx_th_s_005ffielderror_005f1.doStartTag(); + if (_jspx_th_s_005ffielderror_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.reuse(_jspx_th_s_005ffielderror_005f1); + _jspx_th_s_005ffielderror_005f1_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f1, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f1_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ftextfield_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:textfield + org.apache.struts2.views.jsp.ui.TextFieldTag _jspx_th_s_005ftextfield_005f2 = (org.apache.struts2.views.jsp.ui.TextFieldTag) _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.get(org.apache.struts2.views.jsp.ui.TextFieldTag.class); + boolean _jspx_th_s_005ftextfield_005f2_reused = false; + try { + _jspx_th_s_005ftextfield_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005ftextfield_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /validation-lab.jsp(55,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ftextfield_005f2.setName("age"); + int _jspx_eval_s_005ftextfield_005f2 = _jspx_th_s_005ftextfield_005f2.doStartTag(); + if (_jspx_th_s_005ftextfield_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ftextfield_0026_005fname_005fnobody.reuse(_jspx_th_s_005ftextfield_005f2); + _jspx_th_s_005ftextfield_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ftextfield_005f2, _jsp_getInstanceManager(), _jspx_th_s_005ftextfield_005f2_reused); + } + return false; + } + + private boolean _jspx_meth_s_005ffielderror_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_s_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context) + throws java.lang.Throwable { + javax.servlet.jsp.PageContext pageContext = _jspx_page_context; + javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); + // s:fielderror + org.apache.struts2.views.jsp.ui.FieldErrorTag _jspx_th_s_005ffielderror_005f2 = (org.apache.struts2.views.jsp.ui.FieldErrorTag) _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.get(org.apache.struts2.views.jsp.ui.FieldErrorTag.class); + boolean _jspx_th_s_005ffielderror_005f2_reused = false; + try { + _jspx_th_s_005ffielderror_005f2.setPageContext(_jspx_page_context); + _jspx_th_s_005ffielderror_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_s_005fform_005f0); + // /validation-lab.jsp(56,16) name = fieldName type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f2.setFieldName("age"); + // /validation-lab.jsp(56,16) name = cssStyle type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null + _jspx_th_s_005ffielderror_005f2.setCssStyle("color:#e74c3c;font-size:12px;"); + int _jspx_eval_s_005ffielderror_005f2 = _jspx_th_s_005ffielderror_005f2.doStartTag(); + if (_jspx_th_s_005ffielderror_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { + return true; + } + _005fjspx_005ftagPool_005fs_005ffielderror_0026_005ffieldName_005fcssStyle_005fnobody.reuse(_jspx_th_s_005ffielderror_005f2); + _jspx_th_s_005ffielderror_005f2_reused = true; + } finally { + org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_s_005ffielderror_005f2, _jsp_getInstanceManager(), _jspx_th_s_005ffielderror_005f2_reused); + } + return false; + } +}