how to use interceptor defined in different packages in struts 2?
interceptor, interceptorstack, struts2
Solution
Having package "posts" extending "default" would solve the issue.
Problem
I have defined an interceptor as follows: ``` <package name="default" extends="struts-default" > <interceptors> <interceptor-stack name="myStack"> <interceptor-ref name="timer"/> <interceptor-ref name="logger"/> <interceptor-ref name="defaultStack"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="myStack"/> </package> ``` And then use the myStack in another namespace: ``` <package name="posts" namespace="/posts" extends="struts-default,json-default"> <action name="question/ask" class="someclass.QuestionAction"> <interceptor-ref name="myStack"></interceptor-ref> <result name="success">/WEB-INF/jsp/post_question.jsp</result> <result name="input">/WEB-INF/jsp/post_question.jsp</result> </action> </package> ``` This did not work because in the package posts, it could not find the interceptor stack named myStack. How can I solve this problem?