Struts 2 Interceptor構成(3つの方法)
3338 ワード
<struts>
<package name="struts2" extends="struts-default">
<interceptors>
<interceptor name="myInterceptor" class="com.llb.MyInterceptor"></interceptor>
</interceptors>
<action name="register" class="com.llb.RegisterAction">
<result name="input">/register.jsp</result>
<result>/result.jsp</result>
<!-- interceptor , interceptor-stack(defaultStack), defaultStack , -->
<!-- interceptor-ref , , : / ( ) -->
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="myInterceptor"></interceptor-ref>
</action>
</package>
</struts>
<struts>
<package name="struts2" extends="struts-default">
<interceptors>
<interceptor name="myInterceptor" class="com.llb.MyInterceptor"></interceptor>
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="myInterceptor"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<action name="register" class="com.llb.RegisterAction">
<result name="input">/register.jsp</result>
<result>/result.jsp</result>
<interceptor-ref name="myInterceptorStack"></interceptor-ref>
</action>
</package>
</struts>
<struts>
<package name="struts2" extends="struts-default">
<interceptors>
<interceptor name="myInterceptor" class="com.llb.MyInterceptor"></interceptor>
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="myInterceptor"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<!-- interceptor action -->
<!-- action interceptor, action interceptor -->
<default-interceptor-ref name="myInterceptorStack"></default-interceptor-ref>
<action name="register" class="com.llb.RegisterAction">
<result name="input">/register.jsp</result>
<result>/result.jsp</result>
</action>
</package>
</struts>