user6332430
user6332430

Reputation: 460

Struts2 how to override the global interceptor stack for an action

<interceptor-stack name="DefaultTEST">
    <interceptor-ref name="exception" />
    <!-- some more interceptors go in here -->
    <interceptor-ref name="debugging" />
</interceptor-stack>

<default-interceptor-ref name="DefaultTEST" />

<action name="welcome">
    <result type="tiles">WELCOME_PAGE</result>
</action>

<action name="">
    <result ...>...</result>
</action>

... <!-- more actions -->

So my question is how to override the default interceptor stack so that for welcome action some other interceptors (or interceptor stack) can be loaded while the default one is not.

Upvotes: 0

Views: 898

Answers (1)

Roman C
Roman C

Reputation: 1

You can override the interceptors config if you reference an interceptor or interceptors stack in the action config explicitly.

<action name="welcome">
    <interceptor-ref name="defaultStack" />
    <result type="tiles">WELCOME_PAGE</result>
</action>

Only defaultStack will be executed for welcome action. Other actions that don't override the interceptors config in this package will use DefaultTEST because it's configured as default.

Upvotes: 2

Related Questions