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
{
    ....
}

しかし、パラメーターを Message Store Interceptor に渡す方法がわかりません。何かご意見は?

4

1 に答える 1

3

http://www.jarvana.com/jarvana/view/org/apache/struts/struts2-convention-plugin/2.1.8/struts2-convention-plugin-2.1.8-javadoc.jar!/で Javadoc を読んだ後index.html 、答えは次のことでした:

@Action(value = "store", interceptorRefs = {@InterceptorRef(value = "store", params = {"operationMode", "STORE"})})
于 2009-12-29T10:20:19.170 に答える