我目前正在转换Struts 2应用程序以使用Convention插件和Annotations而不是XML配置。
原始XML看起来像:
<action name="store" method="store"
class="com.company.webapp.dop.AuthorAction">
<result name="success" type="redirectAction">list</result>
<result name="input" type="tiles">.author.edit
</result>
<interceptor-ref name="store">
<param name="operationMode">STORE</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />
</action>
我用
取代了@Action(value="store", interceptorRefs=@InterceptorRef("store"))
public String store() throws Exception
{
....
}
但我不确定如何将参数传递给Message Store Interceptor。有什么想法吗?
答案 0 :(得分:3)
在http://www.jarvana.com/jarvana/view/org/apache/struts/struts2-convention-plugin/2.1.8/struts2-convention-plugin-2.1.8-javadoc.jar!/index.html阅读Javadoc之后 ,答案是做到以下几点:
@Action(value = "store", interceptorRefs = {@InterceptorRef(value = "store", params = {"operationMode", "STORE"})})