Forms Struts 2.3表单,具有多个具有action属性的submit标记

Forms Struts 2.3表单,具有多个具有action属性的submit标记,forms,jsp,struts2,dmi,Forms,Jsp,Struts2,Dmi,这是一个非常简单的东西,它与Struts 2.1.x完美结合。但是我们最近升级到了2.3.15.2,它坏了。基本上,我们有一个表单(实际上是许多表单),包含多个提交: <s:form> <s:submit action="save" /> <s:submit action="resetPassword" /> </s:form> 因此,它所做的是将映射的结果设置为具有操作名称的新ServletDispatcherResult: mappi

这是一个非常简单的东西,它与Struts 2.1.x完美结合。但是我们最近升级到了2.3.15.2,它坏了。基本上,我们有一个表单(实际上是许多表单),包含多个提交:

<s:form>
 <s:submit action="save"  />
 <s:submit action="resetPassword"  />
</s:form>
因此,它所做的是将映射的结果设置为具有操作名称的新ServletDispatcherResult:

mapping.setResult(new ServletDispatcherResult(actionName));
另一方面,当在s:form标记中指定操作时,映射的结果为null

因此,当我们最终到达Dispatcher.serviceAction()时:

因此,当在标记中指定操作时,将调用proxy.execute(),它只调用操作/方法本身。这就是应该发生的事情!但是当在标记中指定操作时,由于映射有一个结果,代理的调用被传递到result.execute(),后者调用ServletDispatcherResult。。。最后,我得到了404

要让多个具有动作属性的提交按钮正常工作,似乎需要做很多工作。这是Struts 2.3的已知问题吗?我是否需要为文档中所述的“操作”前缀实现参数化操作

编辑

好的,已知的bug,几天前刚刚打开。同时,我可以降级到2.3.15.1或使用“方法”属性而不是“操作”属性


希望它能很快被修复

这应该是2.3.15.3的固定过程

具体的jira是:


这是struts2.3.16中的b/c

禁用对操作:前缀的支持 默认情况下
struts.mapper.action.prefix.enabled=false

设置


在struts.xml中

struts2核心2.3.16的内部变化


操作:和方法:前缀在默认情况下被排除并更改,以便首先检查excludeParams,然后在Parameters中接受Params接收器

2.3.15.1有2个已知的安全漏洞-详细信息尚未完全发布-但2.3.15.2从根本上被破坏。越来越多的人发现了这个事实,你可能会想,他们会警告人们不要下载它,同时告诉人们只使用2.3.15.1。
Defines a parameter action prefix.  This is executed when the configured prefix key is
matched in a parameter name, allowing the implementation to manipulate the action mapping 
accordingly.  For example, if the "action:foo" parameter name was found, and a 
ParameterAction implementation was registered to handle the "action" prefix, the execute 
method would be called, allowing the implementation to set the "method" value on the 
ActionMapping
mapping.setResult(new ServletDispatcherResult(actionName));
if (mapping.getResult() != null) {
 Result result = mapping.getResult();
 result.execute(proxy.getInvocation());
} else {
 proxy.execute();
}
<constant name="struts.mapper.action.prefix.enabled" value="true"/>