In my application I have configured Session interceptor for the actions in Default package (i.e. actions with result type JSP or tiles). Is there any option to configure Interceptor for actions in JSON package. i.e. Action classes with JSON results.
Here is my Struts.xml
<struts>
<constant name="struts.devMode" value="false" />
<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<interceptors>
<interceptor name="sessionInterceptor" class="com.dar.session.SessionInterceptor" />
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="sessionInterceptor"/>
</interceptor-stack>
</interceptors>
<action name="createCampaign">
<interceptor-ref name="myInterceptorStack"></interceptor-ref>
<result type="tiles">createCampaign</result>
</action>
</package>
<package name="example" namespace="/" extends="json-default">
<result-types>
<result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
</result-types>
<action name="peopleCountAction" class="com.dar.business.BusinessSearchAction" method="findPeopleCount">
<result name="success" type="json">
<param name="includeProperties">peopleCount</param>
</result>
</action>
</package>
</struts>
It will work you just have to define stack and use and remember to use default stack else SessionAware session will become null if you are using it.