在 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/