1
私のアプリケーションでは、デフォルトパッケージ(結果のJSPまたはタイルを含むアクション)のアクションに対してセッションインターセプタを設定しました。 JSONパッケージのアクションに対してインターセプタを設定するオプションはありますか? JSON結果を含むActionクラスStruts2でJSONアクションのインターセプタを持っていますか
は、ここに私の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>
パッケージは論理的な分離であり、インターセプタはリクエスト単位でのみ実行されるため、インターセプタの意味はわかりません –
@Umesh:struts.xmlにはタグがあります。 で宣言されているアクション。私たちはこの行動のために傍受者を持つことができますか? –
あなたは 'default'パッケージで定義されたすべてのアクションを意味しますか? –