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

查看:23
本文介绍了Struts Action 中的多个入口点(迁移 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>

有几个表单元素,都绑定到一个动作.每个表单都有一个单独的提交按钮,带有不同的 method(例如 shopPdfReprint").每个 method 都映射到相应类中的方法.

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"),只调用类的execute()方法.

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

有人遇到过这个吗?

推荐答案

出现这种情况是因为你关闭了 DMI.method 属性与之前一样与提交标记一起使用,即使在重新发送安全修复后也是如此.使用常量启用 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 中的多个入口点(迁移 Struts 2.2.3 -> 2.3.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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