使用带注释的 Struts 2 消息存储拦截器
我目前正在将 Struts 2 应用程序转换为使用约定插件和注释而不是 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
{
....
}
但我不确定如何将参数传递给消息存储拦截器。有什么想法吗?
I am currently converting a Struts 2 application to use the Convention plugin and Annotations instead of the XML configuration.
The original XML looks like:
<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>
which I have replaced with
@Action(value="store", interceptorRefs=@InterceptorRef("store"))
public String store() throws Exception
{
....
}
but I am unsure how to pass in the parameter to the Message Store Interceptor. Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读 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
,答案是执行以下操作:
After reading the Javadoc's at 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
,the answer was to do the following: