Struts2 使用带注释的Struts 2消息存储拦截器
我目前正在将Struts 2应用程序转换为使用约定插件和注释,而不是XML配置 原始XML如下所示:Struts2 使用带注释的Struts 2消息存储拦截器,struts2,annotations,interceptor,Struts2,Annotations,Interceptor,我目前正在将Struts 2应用程序转换为使用约定插件和注释,而不是XML配置 原始XML如下所示: <action name="store" method="store" class="com.company.webapp.dop.AuthorAction"> <result name="success" type="redirectAction">list</result> <result na
<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>
但是我不确定如何将参数传递给消息存储拦截器。有什么想法吗?在阅读了Javadoc的 ,答案是执行以下操作:
@Action(value = "store", interceptorRefs = {@InterceptorRef(value = "store", params = {"operationMode", "STORE"})})
@Action(value = "store", interceptorRefs = {@InterceptorRef(value = "store", params = {"operationMode", "STORE"})})