【发布时间】:2015-04-27 17:48:04
【问题描述】:
似乎我应该能够在 strut.xml 中定义 PER 结果的参数,而不是全局的,但我无法让它工作。以下是有效的方法:
<action name="actThing" class="Thing" method="execute">
<interceptor-ref name="newStack" />
<param name="parentObject">Parent</param>
<result name="Edit">jspEditThing.jsp</result>
<result name="Add">jspAddThing.jsp</result>
</action>
在这种情况下,当调用 Thing.execute 时,会设置 parentObject 变量。但是在这里:
<action name="actThing" class="Thing" method="execute">
<interceptor-ref name="newStack" />
<result name="Add">
<param name="location">jspAddThing.jsp</param>
<param name="parentObject">Parent</param>
</result>
<result name="Edit">jspEditThing.jsp</result>
</action>
它没有。因为它在第一种情况下有效,所以我当然有正确的设置/吸气剂,而且我没有收到任何错误。我错过了什么?
谢谢。
【问题讨论】:
标签: java jsp struts2 action param