カスタムStruts 2ブロッキングおよび構成
1983 ワード
//PS: AbstractInterceptor
//( 2 — — )
public class MyInterceptor implements Interceptor {
@Override
public void destroy() {
// TODO Auto-generated method stub
System.out.println("MyInterceptor ");
}
@Override
public void init() {
// TODO Auto-generated method stub
System.out.println(" ");
}
@Override
public String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
System.out.println("MyInterceptor ");
String result=invocation.invoke(); //
// action execute()
return result;
}
}
------------------------------------------------------------
<!-- -->
<interceptors>
<!--name class -->
<interceptor name="myInterceptor" class="zl.MyInterceptor">
<!-- action -->
</interceptor>
</interceptors>
<!-- -->
<interceptor-stack name="demoInterceptor">
<interceptor-ref name="myInterceptor"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
<!--PS: action -->
<default-interceptor-ref name="demoInterceptor" />
<!-- , action -->
<!-- Action-->
<action name="input3" class="zl.PointAction" method="exec3">
<result>/output.jsp</result>
<result name="input">/input.jsp</result>
<!-- action -->
<interceptor-ref name="demoInterceptor"></interceptor-ref>
</action>