views:

561

answers:

1

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?

A: 

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:

@Action(value = "store", interceptorRefs = {@InterceptorRef(value = "store", params = {"operationMode", "STORE"})})
djsnowsill