package com.briup.web.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class MyInterceptor implements Interceptor{
@Override
public void destroy() {
System.out.println("in destory() of MyInterceptor");
}
@Override
public void init() {
System.out.println("in init() of MyInterceptor");
}
@Override
public String intercept(ActionInvocation ai) throws Exception {
System.out.println("before...");
//ai.invoke();其实就是调用action中将要执行的方法,比如execute方法
//ai.invoke()的返回值其实就是action中方法执行完成返回的字符串
String s = ai.invoke();
System.out.println("after...");
return s;
}
}
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class MyInterceptor implements Interceptor{
@Override
public void destroy() {
System.out.println("in destory() of MyInterceptor");
}
@Override
public void init() {
System.out.println("in init() of MyInterceptor");
}
@Override
public String intercept(ActionInvocation ai) throws Exception {
System.out.println("before...");
//ai.invoke();其实就是调用action中将要执行的方法,比如execute方法
//ai.invoke()的返回值其实就是action中方法执行完成返回的字符串
String s = ai.invoke();
System.out.println("after...");
return s;
}
}