Struts2 dynamic parameter name in redirect-action(重定向动作中的Struts2动态参数名称)
问题描述
我成功地为我的 struts2 映射文件之一使用了重定向操作,如下所示:
I'm successfully using a redirect-action for one of my struts2 mapping files as follows:
<action name="setAsCurrentCart" class="com.fmp.MyAction">
<result name="success" type="redirect-action">
<param name="actionName">myOtherAction</param>
<param name="foo">${foo}</param>
</result>
<interceptor-ref name="defaultComponentStack"/>
</action>
这就是我想做的事情:
<action name="setAsCurrentCart" class="com.fmp.MyAction">
<result name="success" type="redirect-action">
<param name="actionName">myOtherAction</param>
<param name="${dynamicParameterName}">${dynamicParameterValue}</param>
</result>
<interceptor-ref name="defaultComponentStack"/>
</action>
换句话说,我希望我传递的参数的名称是动态的.有谁知道这是否可能?
In other words, I want the name of the parameter that I'm passing to be dynamic. Does anyone know if this is possible?
推荐答案
其实这样不行.但是,我能够通过以下方式完成这项工作:
Actually, that doesn't work. However, I was able to get this working doing the following:
<action name="setAsCurrentCart" class="com.fmp.MyAction">
<result name="success" type="redirect-action">
<param name="actionName">myOtherAction</param>
<param name="${dynamicParameterName}">${dynamicParameterValue}</param>
</result>
</action>
我只是假设它不会起作用.
I had just assumed it wouldn't work.
这篇关于重定向动作中的Struts2动态参数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:重定向动作中的Struts2动态参数名称


基础教程推荐
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01