Struts Action中的多个入口点(Migration Struts 2.2.3 - > 2.3.1) [英] Multiple Entrypoints in Struts Action (Migration Struts 2.2.3 -> 2.3.1)

查看:123
本文介绍了Struts Action中的多个入口点(Migration Struts 2.2.3 - > 2.3.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在struts.xml中有一个动作

I have an action in struts.xml

<action name="reprint" class="reprintAction">
        <result name="success" type="redirectAction">
            <param name="actionName">reprint</param>
            <param name="namespace">/x</param>
            <param name="errorFlag">${errorFlag}</param>
            <param name="message">${message}</param>
        </result>
        <result name="view">/jsp/reprintOverview.jsp</result>
</action>

一个JSP:

<s:form action="reprint">
    <s:select name="selectedPdfPrinter" list="shopPdfPrinterList" listKey="deviceId" listValue="deviceId" theme="simple"/>
    <s:submit value="Print" theme="simple" method="shopPdfReprint"/>
</s:form>

包含多个表单元素,全部绑定到一个操作。
每个表单都有一个单独的提交按钮,其中包含一个不同的方法(例如shopPdfReprint)。
每个方法被映射到相应类中的方法。

with several form elements, all bound to one action. Each form has an individual submit-button with a distinct method (e.g. "shopPdfReprint"). Each method is mapped on to a method in the corresponding class.

一切正常Struts 2.2.3。但是在迁移到2.3.1之后,方法映射不起作用。而是调用相应的方法(例如shopPdfReprint),仅调用该类的执行 -method。

Everything is working fine with Struts 2.2.3. But after Migration to 2.3.1 the method-mapping is not working. Instead calling the corresponding method (e.g. "shopPdfReprint"), only the execute-method of the class is invoked.

我看过Docs,但遗憾的是没有发现任何线索,如何适应2.3.1
有人遇到过这个吗?感谢帮助:]

I've looked at the Docs, but unfortunately found no clue, how to adapt to 2.3.1 Anybody ran into this? Help is appreciated :]

推荐答案

这是因为您关闭了DMI。即使在重新发送安全修复程序之后,方法属性也可以像以前一样使用提交标记。使用常量启用DMI

This happens because you have turned off DMI. The method attribute works with submit tag as before even after resent security fixes. Enable DMI using the constant

<constant name="struts.enable.DynamicMethodInvocation" value="true"/> 

如果它不起作用,请告诉我。

let me know if it didn't work.

这篇关于Struts Action中的多个入口点(Migration Struts 2.2.3 - &gt; 2.3.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆