简体   繁体   中英

How to exclude One action from default interceptor in Struts 2

I want to exclude login action from my default interceptor without putting it a diffrent package

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

the action that i want to exclude is Login Action

<action name="loginUser" class="com.action.LoginAction" method="login">

You don't exclude actions from interceptors, you exclude interceptors from actions.

Specifically, if you want to use the defaultStack for your login action and the loginStack for all the other actions, you do:

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

...

<action name="loginUser" class="com.action.LoginAction" method="login">
    <interceptor-ref name="defaultStack" />
    <result>login.jsp</result>
</action>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM