strtus中Interceptor和AbstractInterceptor区别
Interceptor类
public interface Interceptor extends Serializable {
void destroy();
void init();
String intercept(ActionInvocation var1) throws Exception;
}
AbstractInterceptor类
public abstract class AbstractInterceptor implements Interceptor {
public AbstractInterceptor() {
}
public void init() {
}
public void destroy() {
}
public abstract String intercept(ActionInvocation var1) throws Exception;
}
AbstractInterceptor空实现了 init() 和destroy(),如果只需要intercept(ActionInvocation var1)可以继承AbstractInterceptor抽象类
本文详细解析了Struts框架中的Interceptor和AbstractInterceptor的区别,Interceptor为接口,定义了init, destroy和intercept方法;AbstractInterceptor为抽象类,空实现了init和destroy方法,主要用于减少子类实现的负担。
3690

被折叠的 条评论
为什么被折叠?



