java - 在 Struts 1.2 的 'execute' 中调用不同的方法

标签 java struts

在 struts 1.2 中,当 URL 的形式为 http://foo.com/barAction.do 时被调用时,这将调用映射到 barAction 的操作类中的 execute 方法(或 process)。

当调用上述 URL 时,是否可以在同一操作类中调用除 execute(或 process)之外的其他方法?

最佳答案

您可以使用 DispatchAction 。基本上,它们允许您根据请求参数或操作映射配置选择将调用哪个方法

DispatchAction 至少有 3 种“风格”:EventDispatchAction、LookupDispatchAction 和 MappingDispatchAction。

我建议您看看EventDispatchAction这是在 Struts 1.2.9 中引入的。

关于java - 在 Struts 1.2 的 'execute' 中调用不同的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2943443/

相关文章:

java - 为什么 "int/boolean/..."是没有 "behavior"的主要类型,其中类型是 "behavior specification"

Java 如何使用 apache commons 检查它是否是 Vista、Windows 7 或更高版本

java - Tomcat/Spring boot 重新加载 META-INF/resources/jsp 文件(实时更新)

java - 为什么layout_gravity设置为left/right在水平LinearLayout中没有效果?

java - 如何自定义 <s :fieldError/> tag? 的输出

java - Struts2文件上传错误

java - 在 struts 1.2 中验证后保留表单值

java - DELETE 的默认 struts 处理程序做什么

java - Jenkins 配置文件 Maven 多个 Nexus 存储库下载

java - 错误 SessionMap 无法转换为 java.util.HashMap